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
|
@ -169,7 +169,7 @@ move_ground(s_char *what, struct sctstr *start, struct sctstr *end,
|
|||
else if (dir == DIR_VIEW) {
|
||||
pr("%d%% %s with %d civilians.\n", sect.sct_effic,
|
||||
dchr[sect.sct_type].d_name,
|
||||
getvar(V_CIVIL, (s_char *)§, EF_SECTOR));
|
||||
sect.sct_item[I_CIVIL]);
|
||||
continue;
|
||||
}
|
||||
/*
|
||||
|
@ -347,20 +347,17 @@ int
|
|||
check_lmines(coord x, coord y, double weight)
|
||||
{
|
||||
struct sctstr sect;
|
||||
int mines;
|
||||
int dam = 0;
|
||||
|
||||
getsect(x, y, §);
|
||||
mines = getvar(V_MINE, (s_char *)§, EF_SECTOR);
|
||||
if (mines > 0 &&
|
||||
if (sect.sct_mines > 0 &&
|
||||
sect.sct_oldown != player->cnum &&
|
||||
chance(DMINE_LHITCHANCE(mines)) && chance(weight / 100.0)) {
|
||||
chance(DMINE_LHITCHANCE(sect.sct_mines)) && chance(weight / 100.0)) {
|
||||
pr_beep();
|
||||
pr("Blammo! Landmines detected! in %s ",
|
||||
xyas(sect.sct_x, sect.sct_y, player->cnum));
|
||||
dam = roll(20);
|
||||
--mines;
|
||||
putvar(V_MINE, mines, (s_char *)§, EF_SECTOR);
|
||||
--sect.sct_mines;
|
||||
putsect(§);
|
||||
pr("%d damage sustained.\n", dam);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue