march: Fix check for sector abandonment

sct_prewrite() makes an owned sector revert to the deity when there
are no civilians, military or own land units.

would_abandon() tries to predict that, but gets it wrong: it ignores
land units that evade spy detection or are loaded on ships, and it
fails to ignore land units loaded on land units marching out.

Broken in commit 7c1b166, v4.3.33.  Fix by counting manually rather
than with unitsatxy().

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2016-05-14 22:00:36 +02:00
parent bd9fbca995
commit 7224442533
3 changed files with 38 additions and 9 deletions

View file

@ -29,7 +29,7 @@
* Known contributors to this file:
* Ken Stevens, 1995
* Steve McClure, 1998-2000
* Markus Armbruster, 2004-2015
* Markus Armbruster, 2004-2016
*/
#include <config.h>
@ -954,7 +954,8 @@ lnd_mobcost(struct lndstr *lp, struct sctstr *sp)
/*
* Ask user to confirm sector abandonment, if any.
* All land units in @list must be in the same sector.
* All land units in @list must be in the same sector, owned by the
* player, and not loaded onto anything.
* If removing the land units in @list would abandon their sector, ask
* the user to confirm.
* Return zero when abandonment was declined, else non-zero.