retreat: Oops on retreating ghosts

Code never actually retreated them, but it could zap their mission and
retreat flags.  Harmless, but avoid it anyway.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2014-01-20 22:44:54 +01:00
parent c03db4c5ef
commit c3a839934f

View file

@ -96,6 +96,9 @@ retreat_ship(struct shpstr *sp, char code)
struct nstr_item ni; struct nstr_item ni;
struct shpstr ship; struct shpstr ship;
if (CANT_HAPPEN(!sp->shp_own))
return;
retreat_ship1(sp, code, 1); retreat_ship1(sp, code, 1);
if (sp->shp_rpath[0] == 0) if (sp->shp_rpath[0] == 0)
sp->shp_rflags = 0; sp->shp_rflags = 0;
@ -138,9 +141,6 @@ retreat_ship1(struct shpstr *sp, char code, int orig)
struct mchrstr *mcp; struct mchrstr *mcp;
int changed; int changed;
if (sp->shp_own == 0)
return 0;
if (sp->shp_effic < SHIP_MINEFF) { if (sp->shp_effic < SHIP_MINEFF) {
wu(0, sp->shp_own, wu(0, sp->shp_own,
"%s %s,\nbut it died in the attack, and so couldn't retreat!\n", "%s %s,\nbut it died in the attack, and so couldn't retreat!\n",
@ -352,6 +352,9 @@ retreat_land(struct lndstr *lp, char code)
struct nstr_item ni; struct nstr_item ni;
struct lndstr land; struct lndstr land;
if (CANT_HAPPEN(!lp->lnd_own))
return;
retreat_land1(lp, code, 1); retreat_land1(lp, code, 1);
if (lp->lnd_rpath[0] == 0) if (lp->lnd_rpath[0] == 0)
lp->lnd_rflags = 0; lp->lnd_rflags = 0;
@ -393,9 +396,6 @@ retreat_land1(struct lndstr *lp, char code, int orig)
double mobcost; double mobcost;
struct lchrstr *lcp; struct lchrstr *lcp;
if (lp->lnd_own == 0)
return 0;
if (lp->lnd_effic < LAND_MINEFF) { if (lp->lnd_effic < LAND_MINEFF) {
wu(0, lp->lnd_own, wu(0, lp->lnd_own,
"%s %s,\nbut it died in the attack, and so couldn't retreat!\n", "%s %s,\nbut it died in the attack, and so couldn't retreat!\n",