(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:
parent
3a38e91a5c
commit
2732ac5d1d
15 changed files with 43 additions and 62 deletions
|
@ -203,9 +203,7 @@ extern double lnd_mobcost(struct lndstr *, struct sctstr *, int);
|
||||||
extern char *lnd_path(int, struct lndstr *, char *);
|
extern char *lnd_path(int, struct lndstr *, char *);
|
||||||
|
|
||||||
extern int attack_val(int, struct lndstr *);
|
extern int attack_val(int, struct lndstr *);
|
||||||
extern int total_mil(struct lndstr *);
|
|
||||||
extern int defense_val(struct lndstr *);
|
extern int defense_val(struct lndstr *);
|
||||||
extern int lnd_getmil(struct lndstr *);
|
|
||||||
extern void lnd_print(struct llist *, char *);
|
extern void lnd_print(struct llist *, char *);
|
||||||
extern void lnd_delete(struct llist *, char *);
|
extern void lnd_delete(struct llist *, char *);
|
||||||
extern int lnd_take_casualty(int, struct llist *, int);
|
extern int lnd_take_casualty(int, struct llist *, int);
|
||||||
|
|
|
@ -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);
|
snxtitem_xy(&ni, EF_LAND, sect.sct_x, sect.sct_y);
|
||||||
while (nxtitem(&ni, &land)) {
|
while (nxtitem(&ni, &land)) {
|
||||||
mil += lnd_getmil(&land);
|
mil += land.lnd_item[I_MILIT];
|
||||||
|
|
||||||
/* Anti-terrorist units count double */
|
/* Anti-terrorist units count double */
|
||||||
if (lchr[(int)land.lnd_type].l_flags & L_SECURITY) {
|
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;
|
land.lnd_mobil -= 10;
|
||||||
if (for_real)
|
if (for_real)
|
||||||
putland(land.lnd_uid, &land);
|
putland(land.lnd_uid, &land);
|
||||||
mil += lnd_getmil(&land);
|
mil += land.lnd_item[I_MILIT];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -79,7 +79,7 @@ land(void)
|
||||||
prxy(" %4d,%-4d", land.lnd_x, land.lnd_y, player->cnum);
|
prxy(" %4d,%-4d", land.lnd_x, land.lnd_y, player->cnum);
|
||||||
pr("%c", land.lnd_army);
|
pr("%c", land.lnd_army);
|
||||||
pr("%4d%%", land.lnd_effic);
|
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_harden);
|
||||||
pr("%4d", land.lnd_mobil);
|
pr("%4d", land.lnd_mobil);
|
||||||
pr("%4d", land.lnd_item[I_FOOD]);
|
pr("%4d", land.lnd_item[I_FOOD]);
|
||||||
|
|
|
@ -335,7 +335,7 @@ ldump(void)
|
||||||
pr(" %d", land.lnd_effic);
|
pr(" %d", land.lnd_effic);
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
pr(" %d", lnd_getmil(&land));
|
pr(" %d", land.lnd_item[I_MILIT]);
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
pr(" %d", land.lnd_harden);
|
pr(" %d", land.lnd_harden);
|
||||||
|
|
|
@ -206,7 +206,7 @@ llook(void)
|
||||||
continue;
|
continue;
|
||||||
/* Spies don't need military to do a "llook". Other
|
/* Spies don't need military to do a "llook". Other
|
||||||
units do */
|
units do */
|
||||||
if ((lnd_getmil(&myland) <= 0) &&
|
if ((myland.lnd_item[I_MILIT] <= 0) &&
|
||||||
!(lchr[(int)myland.lnd_type].l_flags & L_SPY))
|
!(lchr[(int)myland.lnd_type].l_flags & L_SPY))
|
||||||
continue;
|
continue;
|
||||||
look_land(&myland);
|
look_land(&myland);
|
||||||
|
@ -288,7 +288,7 @@ look_land(struct lndstr *lookland)
|
||||||
|
|
||||||
pr("%s (#%d) %s (approx %d mil) @ %s\n",
|
pr("%s (#%d) %s (approx %d mil) @ %s\n",
|
||||||
cname(lp->lnd_own), lp->lnd_own,
|
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));
|
xyas(lp->lnd_x, lp->lnd_y, player->cnum));
|
||||||
if (opt_HIDDEN)
|
if (opt_HIDDEN)
|
||||||
setcont(player->cnum, lp->lnd_own, FOUND_LOOK);
|
setcont(player->cnum, lp->lnd_own, FOUND_LOOK);
|
||||||
|
|
|
@ -172,7 +172,7 @@ multifire(void)
|
||||||
pr("Unit %d cannot fire!\n", fland.lnd_uid);
|
pr("Unit %d cannot fire!\n", fland.lnd_uid);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (lnd_getmil(&fland) < 1) {
|
if (fland.lnd_item[I_MILIT] < 1) {
|
||||||
pr("Unit %d cannot fire because it has no military!\n",
|
pr("Unit %d cannot fire because it has no military!\n",
|
||||||
fland.lnd_uid);
|
fland.lnd_uid);
|
||||||
continue;
|
continue;
|
||||||
|
@ -856,7 +856,7 @@ quiet_bigdef(int attacker, struct emp_qelem *list, natid own, natid aown,
|
||||||
if (land.lnd_land >= 0)
|
if (land.lnd_land >= 0)
|
||||||
continue;
|
continue;
|
||||||
/* Gotta have military */
|
/* Gotta have military */
|
||||||
if (lnd_getmil(&land) < 1)
|
if (land.lnd_item[I_MILIT] < 1)
|
||||||
continue;
|
continue;
|
||||||
/* Don't shoot yourself */
|
/* Don't shoot yourself */
|
||||||
if (land.lnd_own == aown)
|
if (land.lnd_own == aown)
|
||||||
|
|
|
@ -80,10 +80,10 @@ shoo(void)
|
||||||
nsec = 0;
|
nsec = 0;
|
||||||
snxtitem_xy(&ni, EF_LAND, sect.sct_x, sect.sct_y);
|
snxtitem_xy(&ni, EF_LAND, sect.sct_x, sect.sct_y);
|
||||||
while (nxtitem(&ni, &land)) {
|
while (nxtitem(&ni, &land)) {
|
||||||
mil += total_mil(&land);
|
mil += land.lnd_item[I_MILIT];
|
||||||
|
|
||||||
if (lchr[(int)land.lnd_type].l_flags & L_SECURITY) {
|
if (lchr[(int)land.lnd_type].l_flags & L_SECURITY) {
|
||||||
mil += total_mil(&land);
|
mil += land.lnd_item[I_MILIT];
|
||||||
nsec++;
|
nsec++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1751,7 +1751,7 @@ count_bodies(struct combat *off, struct emp_qelem *list)
|
||||||
bodies += off[n].troops;
|
bodies += off[n].troops;
|
||||||
for (qp = list->q_forw; qp != list; qp = qp->q_forw) {
|
for (qp = list->q_forw; qp != list; qp = qp->q_forw) {
|
||||||
llp = (struct llist *)qp;
|
llp = (struct llist *)qp;
|
||||||
bodies += total_mil(&llp->land);
|
bodies += llp->land.lnd_item[I_MILIT];
|
||||||
}
|
}
|
||||||
return bodies;
|
return bodies;
|
||||||
}
|
}
|
||||||
|
@ -2117,8 +2117,8 @@ take_casualty(int combat_mode, struct combat *off, struct emp_qelem *olist)
|
||||||
for (qp = olist->q_forw; qp != olist; qp = qp->q_forw) {
|
for (qp = olist->q_forw; qp != olist; qp = qp->q_forw) {
|
||||||
llp = (struct llist *)qp;
|
llp = (struct llist *)qp;
|
||||||
|
|
||||||
if (total_mil(&llp->land) > biggest_mil) {
|
if (llp->land.lnd_item[I_MILIT] > biggest_mil) {
|
||||||
biggest_mil = total_mil(&llp->land);
|
biggest_mil = llp->land.lnd_item[I_MILIT];
|
||||||
biggest = qp;
|
biggest = qp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ military_control(struct sctstr *sp)
|
||||||
snxtitem_xy(&ni, EF_LAND, sp->sct_x, sp->sct_y);
|
snxtitem_xy(&ni, EF_LAND, sp->sct_x, sp->sct_y);
|
||||||
while (nxtitem(&ni, &land)) {
|
while (nxtitem(&ni, &land)) {
|
||||||
if (land.lnd_own == sp->sct_own)
|
if (land.lnd_own == sp->sct_own)
|
||||||
tot_mil += total_mil(&land);
|
tot_mil += land.lnd_item[I_MILIT];
|
||||||
}
|
}
|
||||||
if ((sp->sct_item[I_MILIT] + tot_mil) * 10 < sp->sct_item[I_CIVIL])
|
if ((sp->sct_item[I_MILIT] + tot_mil) * 10 < sp->sct_item[I_CIVIL])
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -78,7 +78,7 @@ attack_val(int combat_mode, struct lndstr *lp)
|
||||||
if (lcp->l_flags & L_SPY && combat_mode == A_ASSAULT)
|
if (lcp->l_flags & L_SPY && combat_mode == A_ASSAULT)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
men = total_mil(lp);
|
men = lp->lnd_item[I_MILIT];
|
||||||
|
|
||||||
value = ldround(((double)men * (double)lp->lnd_att), 1);
|
value = ldround(((double)men * (double)lp->lnd_att), 1);
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ defense_val(struct lndstr *lp)
|
||||||
|
|
||||||
lcp = &lchr[(int)lp->lnd_type];
|
lcp = &lchr[(int)lp->lnd_type];
|
||||||
|
|
||||||
men = total_mil(lp);
|
men = lp->lnd_item[I_MILIT];
|
||||||
|
|
||||||
if (men < 0)
|
if (men < 0)
|
||||||
men = 0;
|
men = 0;
|
||||||
|
@ -138,20 +138,6 @@ defense_val(struct lndstr *lp)
|
||||||
return (int)value;
|
return (int)value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
total_mil(struct lndstr *lp)
|
|
||||||
{
|
|
||||||
struct lchrstr *lcp;
|
|
||||||
double men;
|
|
||||||
|
|
||||||
lcp = &lchr[(int)lp->lnd_type];
|
|
||||||
|
|
||||||
men = lnd_getmil(lp);
|
|
||||||
/* men *= ((double)lp->lnd_effic)/100.0;*/
|
|
||||||
|
|
||||||
return ldround(men, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
lnd_print(struct llist *llp, char *s)
|
lnd_print(struct llist *llp, char *s)
|
||||||
{
|
{
|
||||||
|
@ -193,7 +179,7 @@ lnd_take_casualty(int combat_mode, struct llist *llp, int cas)
|
||||||
signed char orig;
|
signed char orig;
|
||||||
int mob;
|
int mob;
|
||||||
|
|
||||||
taken = lnd_getmil(&llp->land);
|
taken = llp->land.lnd_item[I_MILIT];
|
||||||
/* Spies always die */
|
/* Spies always die */
|
||||||
if (llp->lcp->l_flags & L_SPY) {
|
if (llp->lcp->l_flags & L_SPY) {
|
||||||
eff_eq = 100;
|
eff_eq = 100;
|
||||||
|
@ -214,7 +200,7 @@ lnd_take_casualty(int combat_mode, struct llist *llp, int cas)
|
||||||
return taken;
|
return taken;
|
||||||
} else {
|
} else {
|
||||||
/* Ok, now, how many did we take off? (sould be the diff) */
|
/* Ok, now, how many did we take off? (sould be the diff) */
|
||||||
taken = taken - lnd_getmil(&llp->land);
|
taken = taken - llp->land.lnd_item[I_MILIT];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (llp->land.lnd_effic >= llp->land.lnd_retreat)
|
if (llp->land.lnd_effic >= llp->land.lnd_retreat)
|
||||||
|
@ -332,11 +318,6 @@ lnd_takemob(struct emp_qelem *list, double loss)
|
||||||
llp->land.lnd_mobil = (signed char)new;
|
llp->land.lnd_mobil = (signed char)new;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int
|
|
||||||
lnd_getmil(struct lndstr *lp)
|
|
||||||
{
|
|
||||||
return lp->lnd_item[I_MILIT];
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
lnd_submil(struct lndstr *lp, int num)
|
lnd_submil(struct lndstr *lp, int num)
|
||||||
|
@ -379,18 +360,19 @@ intelligence_report(int destination, struct lndstr *lp, int spy,
|
||||||
else
|
else
|
||||||
sprintf(buf1, "%s %s", mess, prland(lp));
|
sprintf(buf1, "%s %s", mess, prland(lp));
|
||||||
|
|
||||||
estimate = lnd_getmil(lp);
|
estimate = lp->lnd_item[I_MILIT];
|
||||||
|
|
||||||
if (chance((double)(spy + lp->lnd_vis) / 20.0)) {
|
if (chance((double)(spy + lp->lnd_vis) / 20.0)) {
|
||||||
|
|
||||||
if (destination == player->cnum)
|
if (destination == player->cnum)
|
||||||
pr(" (eff %d, mil %d", roundintby(lp->lnd_effic, 5),
|
pr(" (eff %d, mil %d",
|
||||||
roundintby(lnd_getmil(lp), 10));
|
roundintby(lp->lnd_effic, 5),
|
||||||
|
roundintby(lp->lnd_item[I_MILIT], 10));
|
||||||
else
|
else
|
||||||
sprintf(buf2, " (eff %d, mil %d",
|
sprintf(buf2, " (eff %d, mil %d",
|
||||||
roundintby(lp->lnd_effic, 5),
|
roundintby(lp->lnd_effic, 5),
|
||||||
roundintby(lnd_getmil(lp), 10));
|
roundintby(lp->lnd_item[I_MILIT], 10));
|
||||||
estimate = lnd_getmil(lp) * lp->lnd_effic / 100.0;
|
estimate = lp->lnd_item[I_MILIT] * lp->lnd_effic / 100.0;
|
||||||
|
|
||||||
if (chance((double)(spy + lp->lnd_vis) / 20.0)) {
|
if (chance((double)(spy + lp->lnd_vis) / 20.0)) {
|
||||||
int t;
|
int t;
|
||||||
|
@ -600,7 +582,7 @@ lnd_mar(struct emp_qelem *list, double *minmobp, double *maxmobp,
|
||||||
}
|
}
|
||||||
if (!(lchr[(int)llp->land.lnd_type].l_flags & L_SPY) &&
|
if (!(lchr[(int)llp->land.lnd_type].l_flags & L_SPY) &&
|
||||||
!(lchr[(int)llp->land.lnd_type].l_flags & L_TRAIN) &&
|
!(lchr[(int)llp->land.lnd_type].l_flags & L_TRAIN) &&
|
||||||
lnd_getmil(&llp->land) == 0) {
|
llp->land.lnd_item[I_MILIT] == 0) {
|
||||||
lnd_mess("has no mil on it to guide it", llp);
|
lnd_mess("has no mil on it to guide it", llp);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -468,7 +468,7 @@ perform_mission(coord x, coord y, natid victim, struct emp_qelem *list,
|
||||||
if ((lp->lnd_ship != -1) || (lp->lnd_land != -1))
|
if ((lp->lnd_ship != -1) || (lp->lnd_land != -1))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (lnd_getmil(lp) < 1)
|
if (lp->lnd_item[I_MILIT] < 1)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
range = roundrange(effrange(lp->lnd_frg, lp->lnd_tech));
|
range = roundrange(effrange(lp->lnd_frg, lp->lnd_tech));
|
||||||
|
|
|
@ -439,7 +439,7 @@ get_minimum(struct lndstr *lp, i_type type)
|
||||||
if (opt_NOFOOD)
|
if (opt_NOFOOD)
|
||||||
return 0; /* no food reqd, get out */
|
return 0; /* no food reqd, get out */
|
||||||
want = (((double)etu_per_update * eatrate) *
|
want = (((double)etu_per_update * eatrate) *
|
||||||
(double)total_mil(lp)) + 1;
|
(double)lp->lnd_item[I_MILIT]) + 1;
|
||||||
break;
|
break;
|
||||||
case I_SHELL:
|
case I_SHELL:
|
||||||
want = lp->lnd_ammo;
|
want = lp->lnd_ammo;
|
||||||
|
|
|
@ -351,7 +351,7 @@ feed_land(struct lndstr *lp, int etus, int *needed, int doit)
|
||||||
if (opt_NOFOOD)
|
if (opt_NOFOOD)
|
||||||
return 0; /* no food no work to be done */
|
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;
|
food_eaten = etus * eatrate * total_people;
|
||||||
ifood_eaten = (int)food_eaten;
|
ifood_eaten = (int)food_eaten;
|
||||||
if (food_eaten - ifood_eaten > 0)
|
if (food_eaten - ifood_eaten > 0)
|
||||||
|
|
|
@ -174,15 +174,15 @@ guerrilla(struct sctstr *sp)
|
||||||
if (lp->lnd_own != sp->sct_own)
|
if (lp->lnd_own != sp->sct_own)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mil += lnd_getmil(lp);
|
mil += lp->lnd_item[I_MILIT];
|
||||||
|
|
||||||
/* Security troops can now kill up to 1/2 their complement each
|
/* Security troops can now kill up to 1/2 their complement each
|
||||||
update, before doing anything else. */
|
update, before doing anything else. */
|
||||||
if (lchr[(int)lp->lnd_type].l_flags & L_SECURITY) {
|
if (lchr[(int)lp->lnd_type].l_flags & L_SECURITY) {
|
||||||
int che_kill, r;
|
int che_kill, r;
|
||||||
|
|
||||||
mil += lnd_getmil(lp);
|
mil += lp->lnd_item[I_MILIT];
|
||||||
r = (lnd_getmil(lp) * lp->lnd_effic) / 500;
|
r = (lp->lnd_item[I_MILIT] * lp->lnd_effic) / 500;
|
||||||
che_kill = r < 1 ? 0 : roll(r);
|
che_kill = r < 1 ? 0 : roll(r);
|
||||||
if (che_kill > che)
|
if (che_kill > che)
|
||||||
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))
|
if (!(lchr[(int)lp->lnd_type].l_flags & L_SECURITY))
|
||||||
continue;
|
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) {
|
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;
|
mc -= each;
|
||||||
} else if (cantake > 0) {
|
} else if (cantake > 0) {
|
||||||
deq = ((double)cantake / (lnd_getmil(lp) * 2.0)) * 100.0;
|
deq = (cantake / (lp->lnd_item[I_MILIT] * 2.0)) * 100.0;
|
||||||
mc -= (deq / 100.0) * lnd_getmil(lp) * 2.0;
|
mc -= (deq / 100.0) * lp->lnd_item[I_MILIT] * 2.0;
|
||||||
} else
|
} else
|
||||||
deq = 0;
|
deq = 0;
|
||||||
|
|
||||||
|
@ -502,14 +503,14 @@ take_casualties(struct sctstr *sp, int mc)
|
||||||
if (lchr[(int)lp->lnd_type].l_flags & L_SECURITY)
|
if (lchr[(int)lp->lnd_type].l_flags & L_SECURITY)
|
||||||
continue;
|
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) {
|
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;
|
mc -= each;
|
||||||
} else if (cantake > 0) {
|
} else if (cantake > 0) {
|
||||||
deq = ((double)cantake / lnd_getmil(lp)) * 100.0;
|
deq = ((double)cantake / lp->lnd_item[I_MILIT]) * 100.0;
|
||||||
mc -= (deq / 100.0) * lnd_getmil(lp);
|
mc -= (deq / 100.0) * lp->lnd_item[I_MILIT];
|
||||||
} else
|
} else
|
||||||
deq = 0;
|
deq = 0;
|
||||||
|
|
||||||
|
@ -528,7 +529,7 @@ take_casualties(struct sctstr *sp, int mc)
|
||||||
if (lchr[(int)lp->lnd_type].l_flags & L_SECURITY)
|
if (lchr[(int)lp->lnd_type].l_flags & L_SECURITY)
|
||||||
continue;
|
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;
|
lp->lnd_effic = 0;
|
||||||
lnd_submil(lp, 1000); /* Remove 'em all */
|
lnd_submil(lp, 1000); /* Remove 'em all */
|
||||||
wu(0, lp->lnd_own, "%s dies fighting guerrillas in %s\n",
|
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))
|
if (!(lchr[(int)lp->lnd_type].l_flags & L_SECURITY))
|
||||||
continue;
|
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;
|
lp->lnd_effic = 0;
|
||||||
lnd_submil(lp, 1000); /* Kill 'em all */
|
lnd_submil(lp, 1000); /* Kill 'em all */
|
||||||
wu(0, lp->lnd_own, "%s dies fighting guerrillas in %s\n",
|
wu(0, lp->lnd_own, "%s dies fighting guerrillas in %s\n",
|
||||||
|
|
|
@ -431,7 +431,7 @@ feed_ship(struct shpstr *sp, int etus, int *needed, int doit)
|
||||||
if (lp->lnd_ship != sp->shp_uid)
|
if (lp->lnd_ship != sp->shp_uid)
|
||||||
continue;
|
continue;
|
||||||
need = ifood_eaten - sp->shp_item[I_FOOD];
|
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) {
|
if (lp->lnd_item[I_FOOD] - need > land_eaten) {
|
||||||
sp->shp_item[I_FOOD] += need;
|
sp->shp_item[I_FOOD] += need;
|
||||||
lp->lnd_item[I_FOOD] -= need;
|
lp->lnd_item[I_FOOD] -= need;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue