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

@ -66,8 +66,6 @@ y
h
march 78/79 yj
n
h
| TODO empty sector at march prompt
| run out of mob, change leader
march 84/83/80/81/82
jjun

View file

@ -248,7 +248,7 @@ uid owner xloc yloc type effic mobil off tech opx opy mission radius army ship h
75 1 0 4 7 100 127 0 40 0 0 none 0 "" -1 0 42 () "" 0 5 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
76 1 2 6 0 100 104 0 30 1 7 none 3 "" -1 0 42 () "" 0 5 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
77 1 2 6 0 100 104 0 30 1 7 none 3 "" -1 0 42 () "" 0 5 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
78 1 4 6 0 100 104 0 30 3 7 none 3 "" -1 0 42 () "" 0 5 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
78 1 3 7 0 100 127 0 30 3 7 none 3 "" -1 0 42 () "" 0 5 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
79 1 3 7 0 100 127 0 30 3 7 none 3 "" -1 0 42 () "" 0 5 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
80 1 9 5 0 100 60 0 30 3 5 none 3 "" -1 0 42 () "" 0 5 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
81 1 9 5 0 100 60 0 30 3 5 none 3 "" -1 0 42 () "" 0 5 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0

View file

@ -971,13 +971,7 @@
Play#1 output Play#1 1 Leader is cav cavalry #78
Play#1 output Play#1 4 Do you really want to abandon 3,7 [yn]?
Play#1 input n
Play#1 output Play#1 1 cav cavalry #79 stops & stays in 3,7
Play#1 output Play#1 1 + m
Play#1 output Play#1 1 m m m
Play#1 output Play#1 1 m m
Play#1 output Play#1 4 <104.7:104.7: 4,6>
Play#1 input h
Play#1 output Play#1 1 cav cavalry #78 stopped at 4,6
Play#1 output Play#1 1 command failed
Play#1 output Play#1 6 0 567
Play#1 input march 84/83/80/81/82
Play#1 command march
@ -1519,7 +1513,7 @@
Play#0 output Play#0 1 1 75 tra train 0,4 100% 5 0 127 0 40 42% 0 0
Play#0 output Play#0 1 1 76 cav cavalry 2,6 100% 5 0 104 0 30 42% 0 0
Play#0 output Play#0 1 1 77 cav cavalry 2,6 100% 5 0 104 0 30 42% 0 0
Play#0 output Play#0 1 1 78 cav cavalry 4,6 100% 5 0 104 0 30 42% 0 0
Play#0 output Play#0 1 1 78 cav cavalry 3,7 100% 5 0 127 0 30 42% 0 0
Play#0 output Play#0 1 1 79 cav cavalry 3,7 100% 5 0 127 0 30 42% 0 0
Play#0 output Play#0 1 1 80 cav cavalry 9,5 100% 5 0 60 0 30 42% 0 0
Play#0 output Play#0 1 1 81 cav cavalry 9,5 100% 5 0 60 0 30 42% 0 0