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

@ -145,7 +145,6 @@ board 130 5
| as group (fleet u): 132 sinks, 131 unremarkable
board 132 5
50
| BUG: group does not retreat
__cmd added 1 4 0
||| Land units
| BUG: condition b triggers only on hit

View file

@ -83,7 +83,7 @@ uid owner xloc yloc type effic mobil off tech opx opy mission radius fleet civil
104 2 0 4 10 100 127 0 45 0 4 interdiction 1 "" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" -3 1 1 (injured torpedoed helpless) "nn"
120 2 -9 1 18 100 93 0 60 -5 1 none 1 "" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" -3 1 1 () ""
130 2 -9 1 12 100 96 0 60 -5 1 none 1 "" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" -3 1 1 () ""
131 2 -5 1 12 100 127 0 60 -5 1 interdiction 1 "u" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" -3 1 1 (group boarded) "gg"
131 2 -9 1 12 100 96 0 60 -5 1 none 1 "u" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" -3 1 1 () ""
132 0 -5 1 12 0 127 0 60 -5 1 interdiction 1 "u" 0 65 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" -3 1 1 (group boarded) "gg"
149 0 0 0 0 0 0 0 0 0 0 none 0 "" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" 0 0 0 () ""
/config

View file

@ -1415,6 +1415,8 @@
Play#0 output Play#0 1 1 (#1) lost 50 troops trying to board tt troop transport (#132)
Play#0 output Play#0 1 We lost 15 troops defending
Play#0 output Play#0 1 tt troop transport (#132) sunk!
Play#0 output Play#0 1 tt troop transport (#131) retreats along path gg
Play#0 output Play#0 1 tt troop transport (#131) stopped at -9,1
Play#0 output Play#0 1 1 planes spotted over 0,2
Play#0 output Play#0 1 1 bombs did 44% damage to cav cavalry #30 at 0,2
Play#0 output Play#0 1 cav cavalry #30 takes 17
@ -1598,7 +1600,7 @@
Play#0 output Play#0 1 2 104 lc light cruis 0,4 100% 0 10 0 0 0 0 0 0 127 45
Play#0 output Play#0 1 2 120 sb submarine -9,1 100% 0 10 0 0 0 0 0 0 93 60
Play#0 output Play#0 1 2 130 tt troop trans -9,1 100% 0 10 0 0 0 0 0 0 96 60
Play#0 output Play#0 1 2 131 tt troop trans -5,1 u 100% 0 10 0 0 0 0 0 0 127 60
Play#0 output Play#0 1 2 131 tt troop trans -9,1 u 100% 0 10 0 0 0 0 0 0 96 60
Play#0 output Play#0 1 58 ships
Play#0 output Play#0 6 0 640
Play#0 input retr * ?rflags#0 q
@ -1635,8 +1637,7 @@
Play#0 output Play#0 1 2 84 dd destroyer -6,2 nn ihb
Play#0 output Play#0 1 2 101 lc light cruis 0,4 nn ith
Play#0 output Play#0 1 2 104 lc light cruis 0,4 nn ith
Play#0 output Play#0 1 2 131 tt troop trans -5,1 u gg Yes u
Play#0 output Play#0 1 32 ships
Play#0 output Play#0 1 31 ships
Play#0 output Play#0 6 0 639
Play#0 input miss s * ?mission#0 q
Play#0 command mission
@ -1662,7 +1663,6 @@
Play#0 output Play#0 1 dd destroyer (#84) -6,2 -6,2 1 is on an interdiction mission
Play#0 output Play#0 1 lc light cruiser (#101) 0,4 0,4 1 is on an interdiction mission
Play#0 output Play#0 1 lc light cruiser (#104) 0,4 0,4 1 is on an interdiction mission
Play#0 output Play#0 1 tt troop transport (#131) -5,1 -5,1 1 is on an interdiction mission
Play#0 output Play#0 6 0 637
Play#0 input land *
Play#0 command land