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

@ -240,11 +240,11 @@ int
nav_ship(register struct shpstr *sp)
{
struct sctstr *sectp;
s_char *cp, item;
s_char *cp;
int stopping;
int quit;
int didsomething = 0;
int max_amt, food_amt, comm;
int max_amt, food_amt;
s_char buf[1024];
struct emp_qelem ship_list;
struct emp_qelem *qp, *newqp;
@ -332,11 +332,9 @@ nav_ship(register struct shpstr *sp)
}
/* special case for fishing boats */
if ((mchr[(int)sp->shp_type].m_flags & M_FOOD) == 1) {
item = (s_char)'f';
comm = com_num(&item);
food_amt = getvar(comm, (s_char *)sp, EF_SHIP);
max_amt = (vl_find(comm, vship->m_vtype,
vship->m_vamt, (int)vship->m_nv));
food_amt = sp->shp_item[I_FOOD];
max_amt = vl_find(V_FOOD, vship->m_vtype,
vship->m_vamt, vship->m_nv);
sectp = getsectp(sp->shp_x, sp->shp_y);
if (food_amt < max_amt && (sectp->sct_own == 0))