(lnd_getmil, total_mil): Trivial, inline into callers and remove. The

abstraction from actual land unit mil encoding provided by them was
too leaky to be relied upon anyway.
This commit is contained in:
Markus Armbruster 2006-05-20 16:39:58 +00:00
parent 3a38e91a5c
commit 2732ac5d1d
15 changed files with 43 additions and 62 deletions

View file

@ -101,7 +101,7 @@ do_conv(struct nstr_sect nstr, int uwtoconvert, int for_real)
*/
snxtitem_xy(&ni, EF_LAND, sect.sct_x, sect.sct_y);
while (nxtitem(&ni, &land)) {
mil += lnd_getmil(&land);
mil += land.lnd_item[I_MILIT];
/* Anti-terrorist units count double */
if (lchr[(int)land.lnd_type].l_flags & L_SECURITY) {
@ -115,7 +115,7 @@ do_conv(struct nstr_sect nstr, int uwtoconvert, int for_real)
land.lnd_mobil -= 10;
if (for_real)
putland(land.lnd_uid, &land);
mil += lnd_getmil(&land);
mil += land.lnd_item[I_MILIT];
}
}
/*

View file

@ -79,7 +79,7 @@ land(void)
prxy(" %4d,%-4d", land.lnd_x, land.lnd_y, player->cnum);
pr("%c", land.lnd_army);
pr("%4d%%", land.lnd_effic);
pr("%4d", lnd_getmil(&land));
pr("%4d", land.lnd_item[I_MILIT]);
pr("%4d", land.lnd_harden);
pr("%4d", land.lnd_mobil);
pr("%4d", land.lnd_item[I_FOOD]);

View file

@ -335,7 +335,7 @@ ldump(void)
pr(" %d", land.lnd_effic);
break;
case 6:
pr(" %d", lnd_getmil(&land));
pr(" %d", land.lnd_item[I_MILIT]);
break;
case 7:
pr(" %d", land.lnd_harden);

View file

@ -206,7 +206,7 @@ llook(void)
continue;
/* Spies don't need military to do a "llook". Other
units do */
if ((lnd_getmil(&myland) <= 0) &&
if ((myland.lnd_item[I_MILIT] <= 0) &&
!(lchr[(int)myland.lnd_type].l_flags & L_SPY))
continue;
look_land(&myland);
@ -288,7 +288,7 @@ look_land(struct lndstr *lookland)
pr("%s (#%d) %s (approx %d mil) @ %s\n",
cname(lp->lnd_own), lp->lnd_own,
prland(lp), roundintby(total_mil(lp), 20),
prland(lp), roundintby(lp->lnd_item[I_MILIT], 20),
xyas(lp->lnd_x, lp->lnd_y, player->cnum));
if (opt_HIDDEN)
setcont(player->cnum, lp->lnd_own, FOUND_LOOK);

View file

@ -172,7 +172,7 @@ multifire(void)
pr("Unit %d cannot fire!\n", fland.lnd_uid);
continue;
}
if (lnd_getmil(&fland) < 1) {
if (fland.lnd_item[I_MILIT] < 1) {
pr("Unit %d cannot fire because it has no military!\n",
fland.lnd_uid);
continue;
@ -856,7 +856,7 @@ quiet_bigdef(int attacker, struct emp_qelem *list, natid own, natid aown,
if (land.lnd_land >= 0)
continue;
/* Gotta have military */
if (lnd_getmil(&land) < 1)
if (land.lnd_item[I_MILIT] < 1)
continue;
/* Don't shoot yourself */
if (land.lnd_own == aown)

View file

@ -80,10 +80,10 @@ shoo(void)
nsec = 0;
snxtitem_xy(&ni, EF_LAND, sect.sct_x, sect.sct_y);
while (nxtitem(&ni, &land)) {
mil += total_mil(&land);
mil += land.lnd_item[I_MILIT];
if (lchr[(int)land.lnd_type].l_flags & L_SECURITY) {
mil += total_mil(&land);
mil += land.lnd_item[I_MILIT];
nsec++;
}
}