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

@ -160,13 +160,10 @@ new(void)
sect.sct_min = 100;
sect.sct_gmin = 100;
}
if (opt_RES_POP)
putvar(V_CIVIL, 550, (s_char *)&sect, EF_SECTOR);
else
putvar(V_CIVIL, 999, (s_char *)&sect, EF_SECTOR);
putvar(V_MILIT, 55, (s_char *)&sect, EF_SECTOR);
putvar(V_FOOD, 1000, (s_char *)&sect, EF_SECTOR);
putvar(V_UW, 75, (s_char *)&sect, EF_SECTOR);
sect.sct_item[I_CIVIL] = opt_RES_POP ? 550 : 999;
sect.sct_item[I_MILIT] = 55;
sect.sct_item[I_FOOD] = 1000;
sect.sct_item[I_UW] = 75;
putsect(&sect);
getsect(x + 2, y, &sect);
sect.sct_own = num;
@ -188,13 +185,10 @@ new(void)
sect.sct_min = 100;
sect.sct_gmin = 100;
}
if (opt_RES_POP)
putvar(V_CIVIL, 550, (s_char *)&sect, EF_SECTOR);
else
putvar(V_CIVIL, 999, (s_char *)&sect, EF_SECTOR);
putvar(V_FOOD, 100, (s_char *)&sect, EF_SECTOR);
putvar(V_MILIT, 55, (s_char *)&sect, EF_SECTOR);
putvar(V_UW, 75, (s_char *)&sect, EF_SECTOR);
sect.sct_item[I_CIVIL] = opt_RES_POP ? 550 : 999;
sect.sct_item[I_MILIT] = 55;
sect.sct_item[I_FOOD] = 100;
sect.sct_item[I_UW] = 75;
putsect(&sect);
natp->nat_btu = max_btus;
natp->nat_stat &= ~STAT_NEW;
@ -370,7 +364,6 @@ deity_build_land(int type, coord x, coord y, natid own, int tlev)
land.lnd_maxlight = (int)LND_XPL(lp->l_nxlight, tlev - lp->l_tech);
land.lnd_maxland = (int)LND_MXL(lp->l_mxland, tlev - lp->l_tech);
memset(lvec, 0, sizeof(lvec));
getvec(VT_ITEM, lvec, (s_char *)&land, EF_LAND);
lvec[I_FOOD] +=
vl_find(V_FOOD, lp->l_vtype, lp->l_vamt, (int)lp->l_nv);