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
|
@ -214,20 +214,17 @@ setsector(void)
|
|||
if (!snxtsct(&nstr, player->argp[2]))
|
||||
return RET_SYN;
|
||||
while (nxtsct(&nstr, §) > 0) {
|
||||
int mines;
|
||||
|
||||
if (!(p = getstarg(player->argp[3], "What value : ", buf))
|
||||
|| (*p == '\0'))
|
||||
return RET_SYN;
|
||||
amt = atoi(p);
|
||||
mines = getvar(V_MINE, (s_char *)§, EF_SECTOR);
|
||||
current = mines;
|
||||
current = sect.sct_mines;
|
||||
current += amt;
|
||||
if (current < 0)
|
||||
current = 0;
|
||||
if (sect.sct_own != 0)
|
||||
resnoise(§, 1, "Mines", (int)mines, current);
|
||||
putvar(V_MINE, current, (s_char *)§, EF_SECTOR);
|
||||
resnoise(§, 1, "Mines", sect.sct_mines, current);
|
||||
sect.sct_mines = current;
|
||||
putsect(§);
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue