From 3a5e23a02065c5341bea48b5e8c9249290d530cc Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Thu, 31 Dec 2009 11:50:22 +0100 Subject: [PATCH] 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%. --- include/empobj.h | 5 +++-- include/sect.h | 4 ++-- src/lib/common/nsc.c | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/empobj.h b/include/empobj.h index 183021eb5..0cf52d4a7 100644 --- a/include/empobj.h +++ b/include/empobj.h @@ -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; diff --git a/include/sect.h b/include/sect.h index e931e02bb..cab4245e4 100644 --- a/include/sect.h +++ b/include/sect.h @@ -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 */ diff --git a/src/lib/common/nsc.c b/src/lib/common/nsc.c index adab42c42..e49bd9f7b 100644 --- a/src/lib/common/nsc.c +++ b/src/lib/common/nsc.c @@ -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"), -- 2.43.0