(getilist, att_get_combat): Simplify. No functional changes.

This commit is contained in:
Markus Armbruster 2004-03-05 08:05:58 +00:00
parent ade0e97856
commit 99bfa19a92
2 changed files with 8 additions and 10 deletions

View file

@ -1044,7 +1044,7 @@ getilist(struct emp_qelem *list, natid own, struct emp_qelem *a,
struct lndstr land; struct lndstr land;
struct sctstr sect; struct sctstr sect;
struct nstr_item ni; struct nstr_item ni;
u_short *item; int petrol;
struct plist *ip; struct plist *ip;
emp_initque(list); emp_initque(list);
@ -1065,15 +1065,15 @@ getilist(struct emp_qelem *list, natid own, struct emp_qelem *a,
if (!can_fly(plane.pln_uid)) if (!can_fly(plane.pln_uid))
continue; continue;
getship(plane.pln_ship, &ship); getship(plane.pln_ship, &ship);
item = ship.shp_item; petrol = ship.shp_item[I_PETROL];
} else if (plane.pln_land >= 0) { } else if (plane.pln_land >= 0) {
if (!can_fly(plane.pln_uid)) if (!can_fly(plane.pln_uid))
continue; continue;
getland(plane.pln_land, &land); getland(plane.pln_land, &land);
item = land.lnd_item; petrol = land.lnd_item[I_PETROL];
} else { } else {
getsect(plane.pln_x, plane.pln_y, &sect); getsect(plane.pln_x, plane.pln_y, &sect);
item = sect.sct_item; petrol = sect.sct_item[I_PETROL];
#if 0 #if 0
if (sect.sct_effic < 60 && (pcp->pl_flags & P_V) == 0) if (sect.sct_effic < 60 && (pcp->pl_flags & P_V) == 0)
continue; continue;
@ -1083,7 +1083,7 @@ getilist(struct emp_qelem *list, natid own, struct emp_qelem *a,
continue; continue;
#endif #endif
} }
if ((float)item[I_PETROL] < (float)pcp->pl_fuel / 2.0) if ((float)petrol < (float)pcp->pl_fuel / 2.0)
continue; continue;
/* Finally, is it in the list of planes already in /* Finally, is it in the list of planes already in
flight? */ flight? */

View file

@ -203,7 +203,6 @@ att_get_combat(struct combat *com, int isdef)
struct sctstr sect; struct sctstr sect;
struct shpstr ship; struct shpstr ship;
struct lndstr land; struct lndstr land;
u_short *item;
int pstage; int pstage;
natid owner; natid owner;
int mil; int mil;
@ -219,7 +218,7 @@ att_get_combat(struct combat *com, int isdef)
} }
com->sct_type = sect.sct_type; com->sct_type = sect.sct_type;
com->sct_dcp = &dchr[sect.sct_type]; com->sct_dcp = &dchr[sect.sct_type];
item = sect.sct_item; mil = sect.sct_item[I_MILIT];
pstage = sect.sct_pstage; pstage = sect.sct_pstage;
owner = sect.sct_own; owner = sect.sct_own;
eff = sect.sct_effic; eff = sect.sct_effic;
@ -239,7 +238,7 @@ att_get_combat(struct combat *com, int isdef)
return att_combat_init(com, EF_BAD); return att_combat_init(com, EF_BAD);
} }
com->lnd_lcp = &lchr[(int)land.lnd_type]; com->lnd_lcp = &lchr[(int)land.lnd_type];
item = land.lnd_item; mil = land.lnd_item[I_MILIT];
pstage = land.lnd_pstage; pstage = land.lnd_pstage;
owner = land.lnd_own; owner = land.lnd_own;
eff = land.lnd_effic; eff = land.lnd_effic;
@ -276,7 +275,7 @@ att_get_combat(struct combat *com, int isdef)
pr("Ship #%d is not your ship!\n", com->shp_uid); pr("Ship #%d is not your ship!\n", com->shp_uid);
return att_combat_init(com, EF_BAD); return att_combat_init(com, EF_BAD);
} }
item = ship.shp_item; mil = ship.shp_item[I_MILIT];
pstage = ship.shp_pstage; pstage = ship.shp_pstage;
owner = ship.shp_own; owner = ship.shp_own;
eff = ship.shp_effic; eff = ship.shp_effic;
@ -292,7 +291,6 @@ att_get_combat(struct combat *com, int isdef)
return att_combat_init(com, EF_BAD); return att_combat_init(com, EF_BAD);
} }
mil = item[I_MILIT];
if (!com->set) { /* first time */ if (!com->set) { /* first time */
if (isdef) { /* defender */ if (isdef) { /* defender */
com->troops = mil; com->troops = mil;