march: Check for sector abandonment before anyone marches

Unlike the move command, march checks sector abandonment before every
step.

If the player declines, the last land unit stays put and is removed
from the march.

Except when sectors or land units change while we're waiting for the
player's reply.  Then the last unit is not removed from the march.
This can scatter land units.  Screwed up when checking for abandoning
the sector was added in 4.2.2.

Change march to work like move, and to avoid scattering land units: if
the player declines to abandon the sector, the command simply fails.

Put the check into new lnd_abandon_askyn().

Extend would_abandon() and want_to_abandon() from a single land unit
to many.  Rename the latter to abandon_askyn() for consistency.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2014-12-28 21:55:44 +01:00
parent 3b9f2a149b
commit 7c1b1661f5
11 changed files with 71 additions and 47 deletions

View file

@ -118,7 +118,7 @@ explore(void)
pr("Only exploring with %d.\n", amount);
}
if (!want_to_abandon(&sect, vtype, amount, NULL)) {
if (!abandon_askyn(&sect, vtype, amount, NULL)) {
pr("Explore cancelled.\n");
return RET_FAIL;
}