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:
parent
ba86513b01
commit
eccc5cb7d7
86 changed files with 853 additions and 1226 deletions
|
@ -95,11 +95,11 @@ do_demo(struct natstr *natp, struct nstr_sect nstr, int number, s_char *p,
|
|||
while (nxtsct(&nstr, §)) {
|
||||
if (!player->owner || sect.sct_effic < 60)
|
||||
continue;
|
||||
if ((mil = getvar(V_MILIT, (s_char *)§, EF_SECTOR)) == 0)
|
||||
if ((mil = sect.sct_item[I_MILIT]) == 0)
|
||||
continue;
|
||||
if (sect.sct_own != sect.sct_oldown)
|
||||
continue;
|
||||
civ = getvar(V_CIVIL, (s_char *)§, EF_SECTOR);
|
||||
civ = sect.sct_item[I_CIVIL];
|
||||
if (number < 0) {
|
||||
if ((deltamil = mil + number) <= 0)
|
||||
continue;
|
||||
|
@ -117,8 +117,8 @@ do_demo(struct natstr *natp, struct nstr_sect nstr, int number, s_char *p,
|
|||
deltamil, xyas(sect.sct_x, sect.sct_y, player->cnum), mil);
|
||||
if (*p == 'y')
|
||||
reserves += deltamil;
|
||||
putvar(V_MILIT, mil, (s_char *)§, EF_SECTOR);
|
||||
putvar(V_CIVIL, civ, (s_char *)§, EF_SECTOR);
|
||||
sect.sct_item[I_MILIT] = mil;
|
||||
sect.sct_item[I_CIVIL] = civ;
|
||||
putsect(§);
|
||||
}
|
||||
if (!for_real)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue