(mchrstr, lchrstr): Change from variable-style storage of load

capacities to straight arrays.  Users now subscript the array instead
of calling vl_find() or walking the variable data structure.
(mchr, lchr): Initializers adapted.
(vl_find): No longer used.  Remove file.
This commit is contained in:
Markus Armbruster 2004-08-17 14:09:04 +00:00
parent a965b2d25e
commit 8a0854b6b8
22 changed files with 168 additions and 697 deletions

View file

@ -329,8 +329,7 @@ nav_ship(register struct shpstr *sp)
/* special case for fishing boats */
if ((mchr[(int)sp->shp_type].m_flags & M_FOOD) == 1) {
food_amt = sp->shp_item[I_FOOD];
max_amt = vl_find(V_FOOD, vship->m_vtype,
vship->m_vamt, vship->m_nv);
max_amt = vship->m_item[I_FOOD];
sectp = getsectp(sp->shp_x, sp->shp_y);
if (food_amt < max_amt && (sectp->sct_own == 0))

View file

@ -107,8 +107,7 @@ load_it(register struct shpstr *sp, register struct sctstr *psect, int i)
if (comm == V_CIVIL || comm == V_MILIT)
sect_amt--; /* leave 1 civ or mil to hold the sector. */
vship = &mchr[(int)sp->shp_type];
abs_max = max_amt = vl_find(comm, vship->m_vtype,
vship->m_vamt, (int)vship->m_nv);
abs_max = max_amt = vship->m_item[comm];
if (!abs_max)
return 0; /* can't load the ship, skip to the end. */

View file

@ -176,7 +176,7 @@ upd_ship(register struct shpstr *sp, register int etus,
* (double)sp->shp_effic / 100.0
* (double)sectp->sct_oil / 100.0
* prod_eff(product, sp->shp_tech));
max_oil = vl_find(V_OIL, mp->m_vtype, mp->m_vamt, mp->m_nv);
max_oil = mp->m_item[I_OIL];
if (sp->shp_item[I_OIL] + oil_gained > max_oil)
oil_gained = max_oil - sp->shp_item[I_OIL];
sp->shp_item[I_OIL] += oil_gained;
@ -201,7 +201,7 @@ upd_ship(register struct shpstr *sp, register int etus,
if (n > 10)
nreport(sp->shp_own, N_DIE_FAMINE, 0, 1);
}
max_food = vl_find(V_FOOD, mp->m_vtype, mp->m_vamt, mp->m_nv);
max_food = mp->m_item[I_FOOD];
if (sp->shp_item[I_FOOD] > max_food)
sp->shp_item[I_FOOD] = max_food;
/*