(att_move_in_off): Don't put more than ITEM_MAX food into the
assaulted sector. Simplify some more.
This commit is contained in:
parent
ebb472ed58
commit
733aff63ed
1 changed files with 12 additions and 14 deletions
|
@ -2465,10 +2465,12 @@ att_move_in_off(int combat_mode, struct combat *off,
|
||||||
struct sctstr sect;
|
struct sctstr sect;
|
||||||
struct shpstr ship;
|
struct shpstr ship;
|
||||||
int troops;
|
int troops;
|
||||||
int n, lunchbox = 0;
|
int n, lunchbox;
|
||||||
|
|
||||||
move_in_land(combat_mode, off, olist, def);
|
move_in_land(combat_mode, off, olist, def);
|
||||||
|
|
||||||
|
getsect(def->x, def->y, §);
|
||||||
|
|
||||||
for (n = 0; n <= off->last; ++n) {
|
for (n = 0; n <= off->last; ++n) {
|
||||||
if (off[n].type == EF_BAD || !off[n].troops)
|
if (off[n].type == EF_BAD || !off[n].troops)
|
||||||
continue;
|
continue;
|
||||||
|
@ -2483,24 +2485,20 @@ att_move_in_off(int combat_mode, struct combat *off,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
getship(off[n].shp_uid, &ship);
|
getship(off[n].shp_uid, &ship);
|
||||||
lunchbox += (int)((troops + 1) * ship.shp_item[I_FOOD]
|
lunchbox = (int)((troops + 1) * ship.shp_item[I_FOOD]
|
||||||
/ (ship.shp_item[I_MILIT] + troops
|
/ (ship.shp_item[I_MILIT] + troops
|
||||||
+ ship.shp_item[I_CIVIL] + 0.5));
|
+ ship.shp_item[I_CIVIL] + 0.5));
|
||||||
|
if (lunchbox > ITEM_MAX - sect.sct_item[I_FOOD])
|
||||||
|
lunchbox = ITEM_MAX - sect.sct_item[I_FOOD];
|
||||||
|
|
||||||
ship.shp_item[I_FOOD] -= lunchbox;
|
ship.shp_item[I_FOOD] -= lunchbox;
|
||||||
|
sect.sct_item[I_FOOD] += lunchbox;
|
||||||
putship(ship.shp_uid, &ship);
|
putship(ship.shp_uid, &ship);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
put_combat(def);
|
|
||||||
if (!lunchbox)
|
|
||||||
return;
|
|
||||||
if (def->type != EF_SECTOR) {
|
|
||||||
pr("Please tell the deity that you got the 'hungry mole' error\n");
|
|
||||||
logerror("att_move_in_off: hungry mole");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
getsect(def->x, def->y, §);
|
|
||||||
sect.sct_item[I_FOOD] += lunchbox;
|
|
||||||
putsect(§);
|
putsect(§);
|
||||||
|
put_combat(def);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue