]> git.pond.sub.org Git - empserver/commitdiff
Rearrange struct sctstr slightly to expose commonalities with units
authorMarkus Armbruster <armbru@pond.sub.org>
Thu, 31 Dec 2009 10:50:22 +0000 (11:50 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Tue, 19 Jan 2010 07:37:05 +0000 (08:37 +0100)
Nice bonus: space needed for sectors shrinks some 4%.  Size of game
state could shrink perhaps 1-2%.

include/empobj.h
include/sect.h
src/lib/common/nsc.c

index 183021eb54dfc1b30702aee26eaa25e7edb8d46d..0cf52d4a797482e1bc777c99f0f8bf9ca6ec9bd0 100644 (file)
@@ -64,11 +64,12 @@ struct empobj {
     natid own;         /* valid if EFF_OWNER 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 */
-    signed char type;  /* valid for sectors and units */
-    /* remaining are valid for units */
+    /* remaining are valid for sectors and units */
+    signed char type;
     signed char effic;
     signed char mobil;
     unsigned char off;
+    /* remaining are valid for units */
     short tech;
     char group;                /* valid if EFF_GROUP is in table's flags */
     coord opx, opy;
index e931e02bb5845fa27b09a91e5928cd77b437ebe7..cab4245e4162cd652fc1053f87ad60c691c6ad94 100644 (file)
@@ -53,9 +53,10 @@ struct sctstr {
     coord sct_x;               /* x coord of sector */
     coord sct_y;               /* y coord of sector */
     signed char sct_type;      /* sector type */
-    /* end of part matching struct empobj */
     signed char sct_effic;     /* 0% to 100% */
     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_terr;    /* territory 0 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 */
     natid sct_oldown;          /* old owner of sector (for liberation) */
     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_del[I_MAX+1];    /* delivieries */
     short sct_dist[I_MAX+1];   /* distribution thresholds */
index adab42c42791cd09469e323d89410ad83b064693..e49bd9f7bd857a799acfd458646af9baae7d7e78 100644 (file)
@@ -141,6 +141,7 @@ struct castr sect_ca[] = {
     {"des", fldoff(sct_type), NSC_CHAR, 0, NULL, EF_SECTOR_CHR, 0},
     {"effic", fldoff(sct_effic), 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},
     {"terr", 0, NSC_UCHAR, 0, nsc_sct_terr, EF_BAD, NSC_EXTRA},
     {"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},
     {"uran", fldoff(sct_uran), NSC_UCHAR, 0, NULL, EF_BAD, 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},
     NSC_IVEC(fldoff(sct_item), ""),
     NSC_IVEC(fldoff(sct_dist), "_dist"),