Sectors need space for items, deliveries and distribution thresholds.

To save space, the ancients invented `variables': a collection of
key-value pairs, missing means zero value, space for `enough' keys.
This complicates the code, as assigning to a `variable' can fail for
lack of space.  Over time, `enough' increased, and for quite some time
now `variables' have been *wasting* space.  This changeset replaces
them, except in struct mchrstr, struct lchrstr and struct pchrstr,
where they are read-only, and will be replaced later.  It is only a
first step; further cleanup is required.  To simplify and minimize
this necessarily huge changeset, the new item[] arrays have an unused
slot 0, and the old variable types V_CIVIL, ... are still defined, but
must have the same values as the item types I_CIVIL, ...
This commit is contained in:
Markus Armbruster 2004-03-03 16:54:22 +00:00
parent ba86513b01
commit eccc5cb7d7
86 changed files with 853 additions and 1226 deletions

View file

@ -97,7 +97,6 @@ knockdown(struct sctstr *sp, struct emp_qelem *list)
struct lndstr land;
struct plnstr plane;
struct nstr_item ni;
int mines;
struct natstr *np;
if (sp->sct_type == SCT_BTOWER)
@ -161,12 +160,10 @@ knockdown(struct sctstr *sp, struct emp_qelem *list)
plane.pln_effic = 0;
putplane(plane.pln_uid, &plane);
}
/*
* save only the mines; zero the rest of the
* commodities.
*/
mines = getvar(V_MINE, (caddr_t)sp, EF_SECTOR);
sp->sct_nv = 0;
if (mines > 0)
(void)putvar(V_MINE, mines, (caddr_t)sp, EF_SECTOR);
memset(sp->sct_item, 0, sizeof(sp->sct_item));
memset(sp->sct_del, 0, sizeof(sp->sct_del));
memset(sp->sct_dist, 0, sizeof(sp->sct_dist));
sp->sct_pstage = PLG_HEALTHY;
sp->sct_ptime = 0;
sp->sct_che = 0;
}