retreat: Fix group retreat after failed board sinks ship

Group retreat still doesn't work, because when boar() passes a sunk
ship to retreat_ship(), its owner has been reset to POGO already.
This makes it impossible to find the group to retreat.  Instead, it
attempts to retreat ships that sank in the same sector with group
retreat orders and with the same fleet letter assigned.  If any exist,
shp_may_nav() oopses, and prevents actual retreat of these ghosts.

The other retreat conditions don't have this problem, because they
call putship(), which resets the owner, only after retreat_ship().

Making boar() work the same is not practical.  Instead, add an owner
parameter to retreat_ship(), and for symmetry also to retreat_land().

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2015-01-12 21:19:02 +01:00
parent 7b3d541c0d
commit fff476ac4b
11 changed files with 31 additions and 29 deletions

View file

@ -28,6 +28,7 @@
*
* Known contributors to this file:
* Ken Stevens, 1995
* Markus Armbruster, 2014-2015
*/
#ifndef RETREAT_H
@ -48,7 +49,7 @@
#define RET_DCHRGED 64 /* Retreat when depth-charged */
#define RET_BOARDED 128 /* Retreat when unsuccessfully boarded */
extern void retreat_ship(struct shpstr *, char);
extern void retreat_land(struct lndstr *, char);
extern void retreat_ship(struct shpstr *, natid, char);
extern void retreat_land(struct lndstr *, natid, char);
#endif