(att_move_in_off): When boarding from a sector, mil entering the ship
less one were not removed from the sector. The problem is putsect() overwriting data from prior put_combat() with old data. Broken in rev. 1.17. Change lunchbox code to match that of 1.16. Closes #1219918, reported by Doug Wescott.
This commit is contained in:
parent
e6a7d4a694
commit
78e880a608
1 changed files with 16 additions and 14 deletions
|
@ -2461,13 +2461,11 @@ att_move_in_off(int combat_mode, struct combat *off,
|
|||
{
|
||||
struct sctstr sect;
|
||||
struct shpstr ship;
|
||||
int troops;
|
||||
int n, lunchbox;
|
||||
int troops, n;
|
||||
int lunchbox = 0;
|
||||
|
||||
move_in_land(combat_mode, off, olist, def);
|
||||
|
||||
getsect(def->x, def->y, §);
|
||||
|
||||
for (n = 0; n <= off->last; ++n) {
|
||||
if (off[n].type == EF_BAD || !off[n].troops)
|
||||
continue;
|
||||
|
@ -2477,25 +2475,29 @@ att_move_in_off(int combat_mode, struct combat *off,
|
|||
def->mil += troops;
|
||||
put_combat(off + n);
|
||||
if (combat_mode == A_ASSAULT) {
|
||||
if (off[n].type != EF_SHIP || def->type != EF_SECTOR) {
|
||||
logerror("att_move_in_off: strange assault");
|
||||
if (CANT_HAPPEN(off[n].type != EF_SHIP))
|
||||
continue;
|
||||
}
|
||||
getship(off[n].shp_uid, &ship);
|
||||
lunchbox = (int)((troops + 1) * ship.shp_item[I_FOOD]
|
||||
/ (ship.shp_item[I_MILIT] + troops
|
||||
+ ship.shp_item[I_CIVIL] + 0.5));
|
||||
if (lunchbox > ITEM_MAX - sect.sct_item[I_FOOD])
|
||||
lunchbox = ITEM_MAX - sect.sct_item[I_FOOD];
|
||||
lunchbox += (int)((troops + 1) * ship.shp_item[I_FOOD]
|
||||
/ (ship.shp_item[I_MILIT] + troops
|
||||
+ ship.shp_item[I_CIVIL] + 0.5));
|
||||
|
||||
ship.shp_item[I_FOOD] -= lunchbox;
|
||||
sect.sct_item[I_FOOD] += lunchbox;
|
||||
putship(ship.shp_uid, &ship);
|
||||
}
|
||||
}
|
||||
|
||||
putsect(§);
|
||||
put_combat(def);
|
||||
|
||||
if (combat_mode == A_ASSAULT) {
|
||||
if (CANT_HAPPEN(def->type != EF_SECTOR))
|
||||
return;
|
||||
getsect(def->x, def->y, §);
|
||||
if (lunchbox > ITEM_MAX - sect.sct_item[I_FOOD])
|
||||
lunchbox = ITEM_MAX - sect.sct_item[I_FOOD];
|
||||
sect.sct_item[I_FOOD] += lunchbox;
|
||||
putsect(§);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue