edit: Fix fortification limit of embarked planes and land units

We generally preserve the invariant "land units and missiles loaded on
a land unit or ship are never fortified / hardened": fortify and
harden refuse to touch embarked land units and missiles, load and
lload zap land unit fortification on load, and refuse to load hardened
missiles.

The exception is edit, which happily fortifies embarked land units
(edit u key 'F'), hardens embarked missiles (edit p key 'F'), loads
fortified land units (edit u keys 'S' and 'Y') and hardened planes
(edit p keys 's' and 'y').

Fix the first two by correcting the new value's upper limit to zero
for embarked land units and planes.  The next commit will take care of
the rest.

The fix is visible in tests where test setup fortifies land units with
"edit u * F ?..." without excepting embarked ones.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2018-05-10 18:32:54 +02:00
parent b2be5a227d
commit f5514cb452
5 changed files with 17 additions and 10 deletions

View file

@ -213,8 +213,8 @@ uid owner xloc yloc type effic mobil off tech opx opy mission radius army ship h
11 2 1 1 0 100 127 0 30 1 1 reserve 3 "" -1 127 42 (bombed) "hhhhn" 0 5 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
12 1 1 1 0 100 127 0 30 1 1 reserve 3 "" -1 127 42 (bombed) "hhhhn" 0 5 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
13 1 1 1 0 100 127 0 30 1 1 reserve 3 "" -1 127 42 (bombed) "hhhhn" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
14 1 1 1 0 100 127 0 30 1 1 reserve 3 "" 1 127 42 (bombed) "hhhhn" 0 2 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
15 1 1 1 0 100 127 0 30 1 1 reserve 3 "" -1 127 42 (bombed) "hhhhn" 0 2 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 1 0
14 1 1 1 0 100 127 0 30 1 1 reserve 3 "" 1 0 42 (bombed) "hhhhn" 0 2 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
15 1 1 1 0 100 127 0 30 1 1 reserve 3 "" -1 0 42 (bombed) "hhhhn" 0 2 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 1 0
20 1 3 3 0 100 105 0 30 1 3 none 3 "" -1 0 42 () "" 0 5 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
21 1 2 4 0 100 105 0 30 1 3 none 3 "" -1 0 42 () "" 0 5 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
22 1 3 3 7 100 60 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

View file

@ -1575,8 +1575,8 @@
Play#0 output Play#0 1 2 11 cav cavalry 1,1 100% 5 127 127 0 30 42% 0 0
Play#0 output Play#0 1 1 12 cav cavalry 1,1 100% 5 127 127 0 30 42% 0 0
Play#0 output Play#0 1 1 13 cav cavalry 1,1 100% 0 127 127 0 30 42% 0 0
Play#0 output Play#0 1 1 14 cav cavalry 1,1 100% 2 127 127 0 30 42% 0 0 1S
Play#0 output Play#0 1 1 15 cav cavalry 1,1 100% 2 127 127 0 30 42% 0 0 1L
Play#0 output Play#0 1 1 14 cav cavalry 1,1 100% 2 0 127 0 30 42% 0 0 1S
Play#0 output Play#0 1 1 15 cav cavalry 1,1 100% 2 0 127 0 30 42% 0 0 1L
Play#0 output Play#0 1 1 20 cav cavalry 3,3 100% 5 0 105 0 30 42% 0 0
Play#0 output Play#0 1 1 21 cav cavalry 2,4 100% 5 0 105 0 30 42% 0 0
Play#0 output Play#0 1 1 22 tra train 3,3 100% 5 0 60 0 40 42% 0 0

View file

@ -125,10 +125,10 @@ uid owner xloc yloc type effic mobil off tech opx opy mission radius army ship h
28 2 2 2 0 100 107 0 50 3 1 none 3 "g" -1 0 42 (group injured) "g" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
29 2 4 0 0 100 127 0 50 4 0 reserve 3 "g" -1 127 42 (group bombed) "bhg" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
30 0 0 2 0 0 105 0 50 0 2 reserve 3 "c" -1 127 42 (group bombed) "j" 0 9 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
31 2 0 2 0 100 127 0 50 0 2 reserve 3 "c" 35 127 42 (group bombed) "j" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
31 2 0 2 0 99 126 0 50 0 2 reserve 3 "c" 35 0 42 (group bombed) "j" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
32 2 0 2 0 100 127 0 50 0 2 reserve 3 "c" -1 127 42 (group bombed) "j" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
33 2 -1 1 0 85 108 0 50 -1 1 reserve 3 "" -1 127 42 (bombed) "j" 0 9 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
34 2 0 2 0 100 127 0 50 0 2 reserve 3 "c" -1 127 42 (group bombed) "j" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 9 0
34 2 0 2 0 99 126 0 50 0 2 reserve 3 "c" -1 0 42 (group bombed) "j" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 9 0
35 2 0 2 0 100 0 0 50 0 2 reserve 3 "c" -1 127 42 (group bombed) "j" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
36 2 0 2 0 100 127 0 50 0 2 reserve 3 "c" -1 127 42 (group bombed) "j" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
37 2 1 1 7 82 105 0 50 0 0 none 0 "" -1 127 42 (bombed) "j" 0 9 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0

View file

@ -1427,6 +1427,8 @@
Play#0 output Play#0 1 cav cavalry #36 is on the trading block, and can't retreat!
Play#0 output Play#0 1 0,2 takes 4% collateral damage
Play#0 output Play#0 1 tra train #9 takes 1
Play#0 output Play#0 1 cav cavalry #31 takes 1
Play#0 output Play#0 1 cav cavalry #34 takes 1
Play#0 output Play#0 1 1 planes spotted over -1,1
Play#0 output Play#0 1 1 bombs did 40% damage to cav cavalry #33 at -1,1
Play#0 output Play#0 1 cav cavalry #33 takes 15
@ -1681,10 +1683,10 @@
Play#0 output Play#0 1 2 27 cav cavalry 3,1 g 100% 10 127 127 0 50 42% 0 0
Play#0 output Play#0 1 2 28 cav cavalry 2,2 g 100% 10 0 107 0 50 42% 0 0
Play#0 output Play#0 1 2 29 cav cavalry 4,0 g 100% 10 127 127 0 50 42% 0 0
Play#0 output Play#0 1 2 31 cav cavalry 0,2 c 100% 10 127 127 0 50 42% 0 0 35S
Play#0 output Play#0 1 2 31 cav cavalry 0,2 c 99% 10 0 126 0 50 42% 0 0 35S
Play#0 output Play#0 1 2 32 cav cavalry 0,2 c 100% 0 127 127 0 50 42% 0 0
Play#0 output Play#0 1 2 33 cav cavalry -1,1 85% 9 127 108 0 50 42% 0 0
Play#0 output Play#0 1 2 34 cav cavalry 0,2 c 100% 10 127 127 0 50 42% 0 0 9L
Play#0 output Play#0 1 2 34 cav cavalry 0,2 c 99% 10 0 126 0 50 42% 0 0 9L
Play#0 output Play#0 1 2 35 cav cavalry 0,2 c 100% 10 127 0 0 50 42% 0 0
Play#0 output Play#0 1 2 36 cav cavalry 0,2 c 100% 10 127 127 0 50 42% 0 0
Play#0 output Play#0 1 2 37 tra train 1,1 82% 9 127 105 0 50 42% 0 0