board: Don't retreat ship#0 after failed board sinks ship
The root cause is in put_combat(): after it sinks the ship, it calls att_get_combat(), which treats a combat object with a dead ship as an error, tells the attacker "not in the same sector!", and "recovers" by putting the combat object into an error state. Too hard for me to fix right now, so put in a FIXME comment. The error state trips up retreat. boar() uses the victim's ship number in the combat object to find the ship it may have to retreat. Putting the combat object into an error state sets this number to zero. If that ship exists, and isn't owned by the attacker, and has RET_BOARDED set, it retreats. Oops. Broken when Empire 2 factored out common combat code. Fix by saving the ship number while it's still valid. This uncovers the next bug: we now pass a dead ship to retreat_ship(). Oopses since commit f743f37. Its commit message says "Harmless, but avoid it anyway." Going to revert. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
0447bf3f58
commit
ebe4f05d87
4 changed files with 17 additions and 3 deletions
|
@ -415,6 +415,11 @@ put_combat(struct combat *com)
|
|||
putship(com->shp_uid, &ship);
|
||||
}
|
||||
com->mobcost = 0;
|
||||
/*
|
||||
* FIXME if we just sank the ship att_get_combat() will report
|
||||
* "not in the same sector", and proceed to clobber *com. See
|
||||
* also the workaround in boar().
|
||||
*/
|
||||
att_get_combat(com, com->own != player->cnum);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue