extern char *lnd_path(int, struct lndstr *, char *);
extern int attack_val(int, struct lndstr *);
-extern int total_mil(struct lndstr *);
extern int defense_val(struct lndstr *);
-extern int lnd_getmil(struct lndstr *);
extern void lnd_print(struct llist *, char *);
extern void lnd_delete(struct llist *, char *);
extern int lnd_take_casualty(int, struct llist *, int);
*/
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) {
land.lnd_mobil -= 10;
if (for_real)
putland(land.lnd_uid, &land);
- mil += lnd_getmil(&land);
+ mil += land.lnd_item[I_MILIT];
}
}
/*
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]);
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);
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);
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);
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;
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)
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++;
}
}
bodies += off[n].troops;
for (qp = list->q_forw; qp != list; qp = qp->q_forw) {
llp = (struct llist *)qp;
- bodies += total_mil(&llp->land);
+ bodies += llp->land.lnd_item[I_MILIT];
}
return bodies;
}
for (qp = olist->q_forw; qp != olist; qp = qp->q_forw) {
llp = (struct llist *)qp;
- if (total_mil(&llp->land) > biggest_mil) {
- biggest_mil = total_mil(&llp->land);
+ if (llp->land.lnd_item[I_MILIT] > biggest_mil) {
+ biggest_mil = llp->land.lnd_item[I_MILIT];
biggest = qp;
}
}
snxtitem_xy(&ni, EF_LAND, sp->sct_x, sp->sct_y);
while (nxtitem(&ni, &land)) {
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])
return 0;
if (lcp->l_flags & L_SPY && combat_mode == A_ASSAULT)
return 1;
- men = total_mil(lp);
+ men = lp->lnd_item[I_MILIT];
value = ldround(((double)men * (double)lp->lnd_att), 1);
lcp = &lchr[(int)lp->lnd_type];
- men = total_mil(lp);
+ men = lp->lnd_item[I_MILIT];
if (men < 0)
men = 0;
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
lnd_print(struct llist *llp, char *s)
{
signed char orig;
int mob;
- taken = lnd_getmil(&llp->land);
+ taken = llp->land.lnd_item[I_MILIT];
/* Spies always die */
if (llp->lcp->l_flags & L_SPY) {
eff_eq = 100;
return taken;
} else {
/* 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)
llp->land.lnd_mobil = (signed char)new;
}
}
-int
-lnd_getmil(struct lndstr *lp)
-{
- return lp->lnd_item[I_MILIT];
-}
void
lnd_submil(struct lndstr *lp, int num)
else
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 (destination == player->cnum)
- pr(" (eff %d, mil %d", roundintby(lp->lnd_effic, 5),
- roundintby(lnd_getmil(lp), 10));
+ pr(" (eff %d, mil %d",
+ roundintby(lp->lnd_effic, 5),
+ roundintby(lp->lnd_item[I_MILIT], 10));
else
sprintf(buf2, " (eff %d, mil %d",
roundintby(lp->lnd_effic, 5),
- roundintby(lnd_getmil(lp), 10));
- estimate = lnd_getmil(lp) * lp->lnd_effic / 100.0;
+ roundintby(lp->lnd_item[I_MILIT], 10));
+ estimate = lp->lnd_item[I_MILIT] * lp->lnd_effic / 100.0;
if (chance((double)(spy + lp->lnd_vis) / 20.0)) {
int t;
}
if (!(lchr[(int)llp->land.lnd_type].l_flags & L_SPY) &&
!(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);
continue;
}
if ((lp->lnd_ship != -1) || (lp->lnd_land != -1))
continue;
- if (lnd_getmil(lp) < 1)
+ if (lp->lnd_item[I_MILIT] < 1)
continue;
range = roundrange(effrange(lp->lnd_frg, lp->lnd_tech));
if (opt_NOFOOD)
return 0; /* no food reqd, get out */
want = (((double)etu_per_update * eatrate) *
- (double)total_mil(lp)) + 1;
+ (double)lp->lnd_item[I_MILIT]) + 1;
break;
case I_SHELL:
want = lp->lnd_ammo;
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)
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;
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;
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;
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",
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",
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;