(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

@ -351,7 +351,7 @@ feed_land(struct lndstr *lp, int etus, int *needed, int doit)
if (opt_NOFOOD)
return 0; /* no food no work to be done */
total_people = total_mil(lp);
total_people = lp->lnd_item[I_MILIT];
food_eaten = etus * eatrate * total_people;
ifood_eaten = (int)food_eaten;
if (food_eaten - ifood_eaten > 0)

View file

@ -174,15 +174,15 @@ guerrilla(struct sctstr *sp)
if (lp->lnd_own != sp->sct_own)
continue;
mil += lnd_getmil(lp);
mil += lp->lnd_item[I_MILIT];
/* Security troops can now kill up to 1/2 their complement each
update, before doing anything else. */
if (lchr[(int)lp->lnd_type].l_flags & L_SECURITY) {
int che_kill, r;
mil += lnd_getmil(lp);
r = (lnd_getmil(lp) * lp->lnd_effic) / 500;
mil += lp->lnd_item[I_MILIT];
r = (lp->lnd_item[I_MILIT] * lp->lnd_effic) / 500;
che_kill = r < 1 ? 0 : roll(r);
if (che_kill > che)
che_kill = che;
@ -477,14 +477,15 @@ take_casualties(struct sctstr *sp, int mc)
if (!(lchr[(int)lp->lnd_type].l_flags & L_SECURITY))
continue;
cantake = ((lp->lnd_effic - 40) / 100.0) * lnd_getmil(lp) * 2.0;
cantake = ((lp->lnd_effic - 40) / 100.0)
* lp->lnd_item[I_MILIT] * 2.0;
if (cantake >= each) {
deq = ((double)each / (lnd_getmil(lp) * 2.0)) * 100.0;
deq = (each / (lp->lnd_item[I_MILIT] * 2.0)) * 100.0;
mc -= each;
} else if (cantake > 0) {
deq = ((double)cantake / (lnd_getmil(lp) * 2.0)) * 100.0;
mc -= (deq / 100.0) * lnd_getmil(lp) * 2.0;
deq = (cantake / (lp->lnd_item[I_MILIT] * 2.0)) * 100.0;
mc -= (deq / 100.0) * lp->lnd_item[I_MILIT] * 2.0;
} else
deq = 0;
@ -502,14 +503,14 @@ take_casualties(struct sctstr *sp, int mc)
if (lchr[(int)lp->lnd_type].l_flags & L_SECURITY)
continue;
cantake = ((lp->lnd_effic - 40) / 100.0) * lnd_getmil(lp);
cantake = ((lp->lnd_effic - 40) / 100.0) * lp->lnd_item[I_MILIT];
if (cantake >= each) {
deq = ((double)each / (lnd_getmil(lp) * 2.0)) * 100.0;
deq = ((double)each / (lp->lnd_item[I_MILIT] * 2.0)) * 100.0;
mc -= each;
} else if (cantake > 0) {
deq = ((double)cantake / lnd_getmil(lp)) * 100.0;
mc -= (deq / 100.0) * lnd_getmil(lp);
deq = ((double)cantake / lp->lnd_item[I_MILIT]) * 100.0;
mc -= (deq / 100.0) * lp->lnd_item[I_MILIT];
} else
deq = 0;
@ -528,7 +529,7 @@ take_casualties(struct sctstr *sp, int mc)
if (lchr[(int)lp->lnd_type].l_flags & L_SECURITY)
continue;
mc -= (lp->lnd_effic / 100.0) * lnd_getmil(lp);
mc -= (lp->lnd_effic / 100.0) * lp->lnd_item[I_MILIT];
lp->lnd_effic = 0;
lnd_submil(lp, 1000); /* Remove 'em all */
wu(0, lp->lnd_own, "%s dies fighting guerrillas in %s\n",
@ -546,7 +547,7 @@ take_casualties(struct sctstr *sp, int mc)
if (!(lchr[(int)lp->lnd_type].l_flags & L_SECURITY))
continue;
mc -= (lp->lnd_effic / 100.0) * lnd_getmil(lp) * 2.0;
mc -= (lp->lnd_effic / 100.0) * lp->lnd_item[I_MILIT] * 2.0;
lp->lnd_effic = 0;
lnd_submil(lp, 1000); /* Kill 'em all */
wu(0, lp->lnd_own, "%s dies fighting guerrillas in %s\n",

View file

@ -431,7 +431,7 @@ feed_ship(struct shpstr *sp, int etus, int *needed, int doit)
if (lp->lnd_ship != sp->shp_uid)
continue;
need = ifood_eaten - sp->shp_item[I_FOOD];
land_eaten = etus * eatrate * lnd_getmil(lp);
land_eaten = etus * eatrate * lp->lnd_item[I_MILIT];
if (lp->lnd_item[I_FOOD] - need > land_eaten) {
sp->shp_item[I_FOOD] += need;
lp->lnd_item[I_FOOD] -= need;