(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:
parent
a965b2d25e
commit
8a0854b6b8
22 changed files with 168 additions and 697 deletions
|
@ -868,8 +868,7 @@ get_mob_support(int combat_mode, struct combat *off, struct combat *def)
|
|||
case A_BOARD:
|
||||
if (off->type == EF_SECTOR && off->mob <= 0)
|
||||
return 0;
|
||||
mob_support = vl_find(V_MILIT, def->shp_mcp->m_vtype,
|
||||
def->shp_mcp->m_vamt, def->shp_mcp->m_nv);
|
||||
mob_support = def->shp_mcp->m_item[I_MILIT];
|
||||
if (mob_support < off->troops)
|
||||
pr("The size of the ship you are trying to board limits your party to %d mil,\n", mob_support);
|
||||
else
|
||||
|
@ -880,8 +879,7 @@ get_mob_support(int combat_mode, struct combat *off, struct combat *def)
|
|||
return 0;
|
||||
if (def->lnd_lcp->l_flags & L_SPY)
|
||||
return 1;
|
||||
mob_support = vl_find(V_MILIT, def->lnd_lcp->l_vtype,
|
||||
def->lnd_lcp->l_vamt, def->lnd_lcp->l_nv);
|
||||
mob_support = def->lnd_lcp->l_item[I_MILIT];
|
||||
if (mob_support < off->troops)
|
||||
pr("The size of the unit you are trying to board limits your party to %d mil,\n", mob_support);
|
||||
else
|
||||
|
|
|
@ -705,8 +705,7 @@ lnd_sweep(struct emp_qelem *land_list, int verbose, int takemob,
|
|||
putland(llp->land.lnd_uid, &llp->land);
|
||||
if (!(mines = sect.sct_mines))
|
||||
continue;
|
||||
max = vl_find(V_SHELL, llp->lcp->l_vtype,
|
||||
llp->lcp->l_vamt, (int)llp->lcp->l_nv);
|
||||
max = llp->lcp->l_item[I_SHELL];
|
||||
lshells = llp->land.lnd_item[I_SHELL];
|
||||
sshells = sect.sct_item[I_SHELL];
|
||||
for (m = 0; mines > 0 && m < max * 2; m++) {
|
||||
|
|
|
@ -303,8 +303,7 @@ pln_dropoff(struct emp_qelem *list, struct ichrstr *ip, coord tx, coord ty,
|
|||
sp = ptr;
|
||||
there = sp->shp_item[ip->i_vtype];
|
||||
mp = &mchr[(int)sp->shp_type];
|
||||
max = vl_find(ip->i_vtype, mp->m_vtype,
|
||||
mp->m_vamt, (int)mp->m_nv);
|
||||
max = mp->m_item[ip->i_vtype];
|
||||
}
|
||||
there += amt;
|
||||
if (there > max) {
|
||||
|
|
|
@ -279,8 +279,7 @@ retreat_ship1(struct shpstr *sp, s_char code, int orig)
|
|||
|
||||
mines = sect.sct_mines;
|
||||
if ((mcp->m_flags & M_SWEEP) && mines > 0 && !player->owner) {
|
||||
max = vl_find(V_SHELL, mcp->m_vtype,
|
||||
mcp->m_vamt, (int)mcp->m_nv);
|
||||
max = mcp->m_item[I_SHELL];
|
||||
shells = sp->shp_item[I_SHELL];
|
||||
for (m = 0; mines > 0 && m < 5; m++) {
|
||||
if (chance(0.66)) {
|
||||
|
@ -520,8 +519,7 @@ retreat_land1(struct lndstr *lp, s_char code, int orig)
|
|||
mines = sect.sct_mines;
|
||||
if ((lcp->l_flags & L_ENGINEER) && mines > 0 &&
|
||||
(sect.sct_oldown != lp->lnd_own)) {
|
||||
max = vl_find(V_SHELL, lcp->l_vtype,
|
||||
lcp->l_vamt, (int)lcp->l_nv);
|
||||
max = lcp->l_item[I_SHELL];
|
||||
shells = lp->lnd_item[I_SHELL];
|
||||
for (m = 0; mines > 0 && m < 5; m++) {
|
||||
if (chance(0.66)) {
|
||||
|
|
|
@ -420,13 +420,9 @@ void
|
|||
show_ship_capab(int tlev)
|
||||
{
|
||||
register struct mchrstr *mp;
|
||||
register u_short *ap;
|
||||
register u_char *type;
|
||||
register int i;
|
||||
register int it;
|
||||
int scount;
|
||||
int n;
|
||||
s_char c;
|
||||
s_char *p;
|
||||
|
||||
pr("%25s cargos & capabilities\n", "");
|
||||
|
@ -440,18 +436,9 @@ show_ship_capab(int tlev)
|
|||
|
||||
pr("%-25.25s ", mp->m_name);
|
||||
|
||||
/*
|
||||
* should use vector stuff
|
||||
*/
|
||||
for (ap = mp->m_vamt, type = mp->m_vtype, i = 0;
|
||||
i < mp->m_nv; i++, ap++, type++) {
|
||||
it = unitem((int)*type);
|
||||
if (it > 0 && it <= I_MAX && ichr[it].i_name != 0)
|
||||
c = ichr[it].i_name[0];
|
||||
else
|
||||
c = '?';
|
||||
pr(" %d%c", *ap, c);
|
||||
}
|
||||
for (i = 0; i <= I_MAX; ++i)
|
||||
if (mp->m_item[i])
|
||||
pr(" %d%c", mp->m_item[i], ichr[i].i_mnem);
|
||||
pr(" ");
|
||||
for (i = n = 0; i < 32; i++) {
|
||||
if (!(mp->m_flags & bit(i)))
|
||||
|
@ -559,11 +546,8 @@ show_land_capab(int tlev)
|
|||
{
|
||||
struct lchrstr *lcp;
|
||||
int lcount;
|
||||
register u_short *ap;
|
||||
register u_char *type;
|
||||
register int i, n;
|
||||
register int it;
|
||||
register s_char *p, c;
|
||||
register s_char *p;
|
||||
|
||||
pr("%25s capabilities\n", "");
|
||||
|
||||
|
@ -575,18 +559,9 @@ show_land_capab(int tlev)
|
|||
|
||||
pr("%-25s ", lcp->l_name);
|
||||
|
||||
/*
|
||||
* should use vector stuff
|
||||
*/
|
||||
for (ap = lcp->l_vamt, type = lcp->l_vtype, i = 0;
|
||||
i < lcp->l_nv; i++, ap++, type++) {
|
||||
it = unitem((int)*type);
|
||||
if (it > 0 && it <= I_MAX && ichr[it].i_name != 0)
|
||||
c = ichr[it].i_name[0];
|
||||
else
|
||||
c = '?';
|
||||
pr(" %d%c", *ap, c);
|
||||
}
|
||||
for (i = 0; i <= I_MAX; ++i)
|
||||
if (lcp->l_item[i])
|
||||
pr(" %d%c", lcp->l_item[i], ichr[i].i_mnem);
|
||||
pr(" ");
|
||||
for (i = n = 0; i < 32; i++) {
|
||||
if (!(lcp->l_flags & bit(i)))
|
||||
|
|
|
@ -250,8 +250,7 @@ shp_sweep(struct emp_qelem *ship_list, int verbose, natid actor)
|
|||
putship(mlp->ship.shp_uid, &mlp->ship);
|
||||
if (!(mines = sect.sct_mines))
|
||||
continue;
|
||||
max = vl_find(V_SHELL, mlp->mcp->m_vtype,
|
||||
mlp->mcp->m_vamt, (int)mlp->mcp->m_nv);
|
||||
max = mlp->mcp->m_item[I_SHELL];
|
||||
shells = mlp->ship.shp_item[I_SHELL];
|
||||
for (m = 0; mines > 0 && m < 5; m++) {
|
||||
if (chance(0.66)) {
|
||||
|
|
|
@ -439,7 +439,7 @@ get_minimum(struct lndstr *lp, int type)
|
|||
int max, want = 0;
|
||||
|
||||
lcp = &lchr[(int)lp->lnd_type];
|
||||
max = vl_find(V_ITEM(type), lcp->l_vtype, lcp->l_vamt, (int)lcp->l_nv);
|
||||
max = lcp->l_item[type];
|
||||
|
||||
switch (type) {
|
||||
case I_FOOD:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue