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

@ -52,8 +52,6 @@ comm(void)
int nsect;
int n;
struct nstr_sect nstr;
int del[I_MAX + 1];
int dist[I_MAX + 1];
int item[I_MAX + 1];
if (!snxtsct(&nstr, player->argp[1]))
@ -77,31 +75,29 @@ comm(void)
}
if (player->god)
pr("%3d", sect.sct_own);
getvec(VT_DEL, del, (s_char *)&sect, EF_SECTOR);
getvec(VT_DIST, dist, (s_char *)&sect, EF_SECTOR);
getvec(VT_ITEM, item, (s_char *)&sect, EF_SECTOR);
prxy("%4d,%-4d", nstr.x, nstr.y, player->cnum);
pr(" %c", dchr[sect.sct_type].d_mnem);
pr(" %c", dirstr[del[I_SHELL] & 0x7]);
pr("%c", dirstr[del[I_GUN] & 0x7]);
pr("%c", dirstr[del[I_PETROL] & 0x7]);
pr("%c", dirstr[del[I_IRON] & 0x7]);
pr("%c", dirstr[del[I_DUST] & 0x7]);
pr("%c", dirstr[del[I_BAR] & 0x7]);
pr("%c", dirstr[del[I_OIL] & 0x7]);
pr("%c", dirstr[del[I_LCM] & 0x7]);
pr("%c", dirstr[del[I_HCM] & 0x7]);
pr("%c", dirstr[del[I_RAD] & 0x7]);
prthresh(" %c", dist[I_SHELL]);
prthresh("%c", dist[I_GUN]);
prthresh("%c", dist[I_PETROL]);
prthresh("%c", dist[I_IRON]);
prthresh("%c", dist[I_DUST]);
prthresh("%c", dist[I_BAR]);
prthresh("%c", dist[I_OIL]);
prthresh("%c", dist[I_LCM]);
prthresh("%c", dist[I_HCM]);
prthresh("%c", dist[I_RAD]);
pr(" %c", dirstr[sect.sct_del[I_SHELL] & 0x7]);
pr("%c", dirstr[sect.sct_del[I_GUN] & 0x7]);
pr("%c", dirstr[sect.sct_del[I_PETROL] & 0x7]);
pr("%c", dirstr[sect.sct_del[I_IRON] & 0x7]);
pr("%c", dirstr[sect.sct_del[I_DUST] & 0x7]);
pr("%c", dirstr[sect.sct_del[I_BAR] & 0x7]);
pr("%c", dirstr[sect.sct_del[I_OIL] & 0x7]);
pr("%c", dirstr[sect.sct_del[I_LCM] & 0x7]);
pr("%c", dirstr[sect.sct_del[I_HCM] & 0x7]);
pr("%c", dirstr[sect.sct_del[I_RAD] & 0x7]);
prthresh(" %c", sect.sct_dist[I_SHELL]);
prthresh("%c", sect.sct_dist[I_GUN]);
prthresh("%c", sect.sct_dist[I_PETROL]);
prthresh("%c", sect.sct_dist[I_IRON]);
prthresh("%c", sect.sct_dist[I_DUST]);
prthresh("%c", sect.sct_dist[I_BAR]);
prthresh("%c", sect.sct_dist[I_OIL]);
prthresh("%c", sect.sct_dist[I_LCM]);
prthresh("%c", sect.sct_dist[I_HCM]);
prthresh("%c", sect.sct_dist[I_RAD]);
pr("%4d", item[I_SHELL]);
pr("%4d", item[I_GUN]);
pr("%5d", item[I_PETROL]);