Rearrange struct sctstr slightly to expose commonalities with units

Nice bonus: space needed for sectors shrinks some 4%.  Size of game
state could shrink perhaps 1-2%.
This commit is contained in:
Markus Armbruster 2009-12-31 11:50:22 +01:00
parent aa659c7754
commit 3a5e23a020
3 changed files with 6 additions and 5 deletions

View file

@ -64,11 +64,12 @@ struct empobj {
natid own; /* valid if EFF_OWNER is in table's flags */ natid own; /* valid if EFF_OWNER is in table's flags */
coord x; /* valid if EFF_XY is in table's flags */ coord x; /* valid if EFF_XY is in table's flags */
coord y; /* valid if EFF_XY is in table's flags */ coord y; /* valid if EFF_XY is in table's flags */
signed char type; /* valid for sectors and units */ /* remaining are valid for sectors and units */
/* remaining are valid for units */ signed char type;
signed char effic; signed char effic;
signed char mobil; signed char mobil;
unsigned char off; unsigned char off;
/* remaining are valid for units */
short tech; short tech;
char group; /* valid if EFF_GROUP is in table's flags */ char group; /* valid if EFF_GROUP is in table's flags */
coord opx, opy; coord opx, opy;

View file

@ -53,9 +53,10 @@ struct sctstr {
coord sct_x; /* x coord of sector */ coord sct_x; /* x coord of sector */
coord sct_y; /* y coord of sector */ coord sct_y; /* y coord of sector */
signed char sct_type; /* sector type */ signed char sct_type; /* sector type */
/* end of part matching struct empobj */
signed char sct_effic; /* 0% to 100% */ signed char sct_effic; /* 0% to 100% */
signed char sct_mobil; /* mobility units */ signed char sct_mobil; /* mobility units */
unsigned char sct_off; /* Should this sector produce? */
/* end of part matching struct empobj */
unsigned char sct_loyal; /* updates until civilans "converted" */ unsigned char sct_loyal; /* updates until civilans "converted" */
unsigned char sct_terr; /* territory 0 id # of sector */ unsigned char sct_terr; /* territory 0 id # of sector */
unsigned char sct_terr1; /* territory 1 id # of sector */ unsigned char sct_terr1; /* territory 1 id # of sector */
@ -77,7 +78,6 @@ struct sctstr {
unsigned char sct_uran; /* uranium ore content */ unsigned char sct_uran; /* uranium ore content */
natid sct_oldown; /* old owner of sector (for liberation) */ natid sct_oldown; /* old owner of sector (for liberation) */
unsigned char sct_updated; /* Has this sect been updated? */ unsigned char sct_updated; /* Has this sect been updated? */
unsigned char sct_off; /* Should this sector produce? */
short sct_item[I_MAX+1]; /* amount of items stored here */ short sct_item[I_MAX+1]; /* amount of items stored here */
short sct_del[I_MAX+1]; /* delivieries */ short sct_del[I_MAX+1]; /* delivieries */
short sct_dist[I_MAX+1]; /* distribution thresholds */ short sct_dist[I_MAX+1]; /* distribution thresholds */

View file

@ -141,6 +141,7 @@ struct castr sect_ca[] = {
{"des", fldoff(sct_type), NSC_CHAR, 0, NULL, EF_SECTOR_CHR, 0}, {"des", fldoff(sct_type), NSC_CHAR, 0, NULL, EF_SECTOR_CHR, 0},
{"effic", fldoff(sct_effic), NSC_CHAR, 0, NULL, EF_BAD, 0}, {"effic", fldoff(sct_effic), NSC_CHAR, 0, NULL, EF_BAD, 0},
{"mobil", fldoff(sct_mobil), NSC_CHAR, 0, NULL, EF_BAD, 0}, {"mobil", fldoff(sct_mobil), NSC_CHAR, 0, NULL, EF_BAD, 0},
{"off", fldoff(sct_off), NSC_UCHAR, 0, NULL, EF_BAD, 0},
{"loyal", fldoff(sct_loyal), NSC_UCHAR, 0, NULL, EF_BAD, NSC_DEITY}, {"loyal", fldoff(sct_loyal), NSC_UCHAR, 0, NULL, EF_BAD, NSC_DEITY},
{"terr", 0, NSC_UCHAR, 0, nsc_sct_terr, EF_BAD, NSC_EXTRA}, {"terr", 0, NSC_UCHAR, 0, nsc_sct_terr, EF_BAD, NSC_EXTRA},
{"terr0", fldoff(sct_terr), NSC_UCHAR, 0, NULL, EF_BAD, 0}, {"terr0", fldoff(sct_terr), NSC_UCHAR, 0, NULL, EF_BAD, 0},
@ -161,7 +162,6 @@ struct castr sect_ca[] = {
{"ocontent", fldoff(sct_oil), NSC_UCHAR, 0, NULL, EF_BAD, 0}, {"ocontent", fldoff(sct_oil), NSC_UCHAR, 0, NULL, EF_BAD, 0},
{"uran", fldoff(sct_uran), NSC_UCHAR, 0, NULL, EF_BAD, 0}, {"uran", fldoff(sct_uran), NSC_UCHAR, 0, NULL, EF_BAD, 0},
{"oldown", fldoff(sct_oldown), NSC_NATID, 0, NULL, EF_NATION, 0}, {"oldown", fldoff(sct_oldown), NSC_NATID, 0, NULL, EF_NATION, 0},
{"off", fldoff(sct_off), NSC_UCHAR, 0, NULL, EF_BAD, 0},
{"track", 0, NSC_LONG, 0, nsc_sct_track, EF_BAD, NSC_EXTRA}, {"track", 0, NSC_LONG, 0, nsc_sct_track, EF_BAD, NSC_EXTRA},
NSC_IVEC(fldoff(sct_item), ""), NSC_IVEC(fldoff(sct_item), ""),
NSC_IVEC(fldoff(sct_dist), "_dist"), NSC_IVEC(fldoff(sct_dist), "_dist"),