attsub: Clean up take_casualty() a bit

Giving biggest the appropriate type saves a type cast.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2014-01-25 11:40:04 +01:00
parent 76ca2011c3
commit 47af370eaa

View file

@ -2037,8 +2037,8 @@ take_casualty(int combat_mode, struct combat *off, struct emp_qelem *olist)
int to_take = CASUALTY_LUMP; int to_take = CASUALTY_LUMP;
int biggest_troops = 0, index = -1; int biggest_troops = 0, index = -1;
int n, tot_troops = 0, biggest_mil, cas; int n, tot_troops = 0, biggest_mil, cas;
struct emp_qelem *qp, *biggest; struct emp_qelem *qp;
struct ulist *llp; struct ulist *llp, *biggest;
for (n = 0; n <= off->last; ++n) { for (n = 0; n <= off->last; ++n) {
if (off[n].type != EF_BAD) { if (off[n].type != EF_BAD) {
@ -2099,14 +2099,13 @@ take_casualty(int combat_mode, struct combat *off, struct emp_qelem *olist)
if (llp->unit.land.lnd_item[I_MILIT] > biggest_mil) { if (llp->unit.land.lnd_item[I_MILIT] > biggest_mil) {
biggest_mil = llp->unit.land.lnd_item[I_MILIT]; biggest_mil = llp->unit.land.lnd_item[I_MILIT];
biggest = qp; biggest = llp;
} }
} }
if (biggest == NULL) if (biggest == NULL)
return CASUALTY_LUMP - to_take; return CASUALTY_LUMP - to_take;
llp = (struct ulist *)biggest; cas = lnd_take_casualty(combat_mode, biggest, to_take);
cas = lnd_take_casualty(combat_mode, llp, to_take);
return CASUALTY_LUMP - (to_take - cas); return CASUALTY_LUMP - (to_take - cas);
} }