(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

@ -754,7 +754,7 @@ load_comm_ship(struct sctstr *sectp, struct shpstr *sp,
return RET_SYN;
ship_amt = sp->shp_item[item];
ship_max = vl_find(item, mcp->m_vtype, mcp->m_vamt, mcp->m_nv);
ship_max = mcp->m_item[item];
sect_amt = sectp->sct_item[item];
amount = atoi(p);
if (amount < 0)
@ -957,7 +957,7 @@ load_comm_land(struct sctstr *sectp, struct lndstr *lp,
return RET_SYN;
land_amt = lp->lnd_item[item];
land_max = vl_find(item, lcp->l_vtype, lcp->l_vamt, lcp->l_nv);
land_max = lcp->l_item[item];
sect_amt = sectp->sct_item[item];
amount = atoi(p);
if (amount < 0)

View file

@ -94,8 +94,7 @@ ltend(void)
return RET_FAIL;
}
vbase = &mchr[(int)tender.shp_type];
maxtender = vl_find(ip->i_vtype, vbase->m_vtype,
vbase->m_vamt, (int)vbase->m_nv);
maxtender = vbase->m_item[ip->i_vtype];
if (maxtender == 0) {
pr("A %s cannot hold any %s\n",
mchr[(int)tender.shp_type].m_name, ip->i_name);
@ -121,8 +120,7 @@ ltend(void)
continue;
}
lbase = &lchr[(int)target.lnd_type];
maxtarget = vl_find(ip->i_vtype, lbase->l_vtype,
lbase->l_vamt, (int)lbase->l_nv);
maxtarget = lbase->l_item[ip->i_vtype];
if (amt < 0) {
if (!player->owner)
amt = 0;

View file

@ -362,7 +362,7 @@ deity_build_land(int type, coord x, coord y, natid own, int tlev)
land.lnd_fuelu = (int)LND_FU(lp->l_fuelu, tlev - lp->l_tech);
land.lnd_maxlight = (int)LND_XPL(lp->l_nxlight, tlev - lp->l_tech);
land.lnd_maxland = (int)LND_MXL(lp->l_mxland, tlev - lp->l_tech);
land.lnd_item[I_FOOD] = vl_find(V_FOOD, lp->l_vtype, lp->l_vamt, lp->l_nv);
land.lnd_item[I_FOOD] = lp->l_item[I_FOOD];
putland(land.lnd_uid, &land);
makenotlost(EF_LAND, land.lnd_own, land.lnd_uid, land.lnd_x,

View file

@ -121,8 +121,7 @@ tend(void)
return RET_FAIL;
}
vbase = &mchr[(int)tender.shp_type];
maxtender = vl_find(ip->i_vtype, vbase->m_vtype,
vbase->m_vamt, (int)vbase->m_nv);
maxtender = vbase->m_item[ip->i_vtype];
if (maxtender == 0) {
pr("A %s cannot hold any %s\n",
mchr[(int)tender.shp_type].m_name, ip->i_name);
@ -150,8 +149,7 @@ tend(void)
continue;
}
vbase = &mchr[(int)target.shp_type];
maxtarget = vl_find(ip->i_vtype, vbase->m_vtype,
vbase->m_vamt, (int)vbase->m_nv);
maxtarget = vbase->m_item[ip->i_vtype];
if (amt < 0) {
if (!player->owner)
amt = 0;