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
|
@ -66,7 +66,7 @@ shoo(void)
|
|||
ip = whatitem(player->argp[1], "Shoot what <civ or uw> ");
|
||||
if (ip == 0 || (ip->i_vtype != V_CIVIL && ip->i_vtype != V_UW))
|
||||
return RET_SYN;
|
||||
item = ip - ichr;
|
||||
item = ip->i_vtype;
|
||||
if (!snxtsct(&nstr, player->argp[2]))
|
||||
return RET_SYN;
|
||||
sprintf(prompt, "number of %s to shoot (max 999)? ", ip->i_name);
|
||||
|
@ -122,13 +122,13 @@ shoo(void)
|
|||
nshot, ip->i_name, xyas(sect.sct_x, sect.sct_y, player->cnum));
|
||||
if (chance(nshot / 100.0))
|
||||
nreport(player->cnum, N_SHOOT_CIV, sect.sct_oldown, 1);
|
||||
if (vec[item] <= 0 && ip->i_vtype == V_CIVIL &&
|
||||
(sect.sct_own != sect.sct_oldown)) {
|
||||
if (vec[item] <= 0 && item == V_CIVIL
|
||||
&& (sect.sct_own != sect.sct_oldown)) {
|
||||
sect.sct_oldown = sect.sct_own;
|
||||
pr(" %s is now completely yours\n",
|
||||
xyas(sect.sct_x, sect.sct_y, player->cnum));
|
||||
}
|
||||
putvar(ip->i_vtype, vec[item], (s_char *)§, EF_SECTOR);
|
||||
sect.sct_item[item] = vec[item];
|
||||
putsect(§);
|
||||
}
|
||||
return RET_OK;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue