From fd303fc6b3739797900ddda45ec52e5058f8603e Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sun, 27 Aug 2017 14:47:31 +0200 Subject: [PATCH] edit: Implement editing of missile fortification The edit command doesn't support editing plane fortification. Has always been that way. Implement it as key 'F'. Signed-off-by: Markus Armbruster --- src/lib/commands/edit.c | 7 +++++ tests/actofgod/final.xdump | 20 ++++++++----- tests/actofgod/geninput.pl | 7 ++++- tests/actofgod/journal.log | 58 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 84 insertions(+), 8 deletions(-) diff --git a/src/lib/commands/edit.c b/src/lib/commands/edit.c index 78124648..c345f168 100644 --- a/src/lib/commands/edit.c +++ b/src/lib/commands/edit.c @@ -1133,6 +1133,13 @@ edit_plane(struct plnstr *plane, char *key, char *p) "from %d to %d", plane->pln_tech, arg); pln_set_tech(plane, arg); break; + case 'F': + arg = LIMIT_TO(arg, 0, pcp->pl_flags & P_M ? 127 : 0); + divine_unit_change((struct empobj *)plane, "Fortification", + arg != plane->pln_harden, arg - plane->pln_harden, + "from %d to %d", plane->pln_harden, arg); + plane->pln_harden = arg; + break; case 'r': arg = LIMIT_TO(arg, 0, pl_range(pcp, plane->pln_tech)); divine_unit_change((struct empobj *)plane, "Range", diff --git a/tests/actofgod/final.xdump b/tests/actofgod/final.xdump index 7bde7edd..0470238e 100644 --- a/tests/actofgod/final.xdump +++ b/tests/actofgod/final.xdump @@ -189,6 +189,10 @@ uid owner xloc yloc type effic mobil off tech opx opy mission radius wing range 6 1 0 0 9 10 0 0 90 0 0 none 0 "" 0 0 -1 -1 () 0 0.00000 7 1 0 0 9 10 0 0 90 0 0 none 0 "" 17 0 -1 -1 () 0 0.00000 8 1 0 0 0 10 0 0 90 0 0 none 0 "" 9 0 -1 -1 () 0 0.00000 +12 1 0 0 28 10 0 0 145 0 0 none 0 "" 0 0 -1 -1 () 0 0.00000 +13 1 0 0 28 10 0 0 145 0 0 none 0 "" 0 0 -1 -1 () 0 0.00000 +14 1 0 0 28 10 0 0 145 0 0 none 0 "" 0 127 -1 -1 () 0 0.00000 +15 1 0 0 28 10 0 0 145 0 0 none 0 "" 0 127 -1 -1 () 0 0.00000 49 0 0 0 0 0 0 0 0 0 0 none 0 "" 0 0 -1 -1 () 0 0.00000 /config config land @@ -216,20 +220,22 @@ uid owner xloc yloc type effic mobil off tech opx opy mission radius stockpile p config news actor action victim times duration time 0 44 1 47 0 0 -0 43 2 7 0 0 -0 44 3 28 0 0 -0 43 1 105 0 0 +0 43 2 6 0 0 +0 44 3 27 0 0 +0 43 1 109 0 0 0 42 1 20 0 0 1 45 0 3 0 0 -0 43 3 53 0 0 +0 43 3 47 0 0 0 44 2 14 0 0 0 42 2 20 0 0 2 45 0 2 0 0 0 42 3 6 0 0 -0 44 1 5 0 0 +0 44 1 6 0 0 +0 43 2 5 0 0 +0 44 3 1 0 0 +0 43 1 7 0 0 0 43 4 2 0 0 -0 43 2 4 0 0 -0 43 1 3 0 0 +0 43 3 6 0 0 0 33 0 2 0 0 /config config trade diff --git a/tests/actofgod/geninput.pl b/tests/actofgod/geninput.pl index 4232cabf..520e33b8 100755 --- a/tests/actofgod/geninput.pl +++ b/tests/actofgod/geninput.pl @@ -261,13 +261,18 @@ edit_int('ship', 2, ( edit('plane', 6, 'T', 'mb', 'O', 1, 'T', 'mb', 'T', 'hb', 'T', 'mb'); edit('plane', 7, 'O', 1, 'r', 255, 'T', 'hb', 'T', 'mb'); edit('plane', 8, 'O', 1, 'T', 'hb', 'r', 255, 'T', 'f1'); +edit('plane', 12, 'T', 'ssm', 'O', 1, 'U', 13, 'U', 14, 'U', 15); -# plane: effic mobil range tech +# plane: effic mobil range tech harden edit_int('plane', 2, ( ['e', 0, 100], ['m', -127, 127], ['r', 0, 9], ['t', 50, 32767], + ['F', 0, 0], +)); +edit_int('plane', 12, ( + ['F', 0, 127], )); # land: type diff --git a/tests/actofgod/journal.log b/tests/actofgod/journal.log index 665793a4..c131547a 100644 --- a/tests/actofgod/journal.log +++ b/tests/actofgod/journal.log @@ -1418,6 +1418,15 @@ Play#0 output Play#0 1 Range of hb B-26B Marauder #8 changed from 0 to 15 Play#0 output Play#0 1 Type of hb B-26B Marauder #8 changed to f1 Sopwith Camel Play#0 output Play#0 6 0 640 + Play#0 input edit p 12 T ssm O 1 U 13 U 14 U 15 + Play#0 command edit + Play#0 output Play#0 1 Type of f1 Sopwith Camel #12 changed to ssm V2 + Play#0 output Play#0 1 Owner of ssm V2 #12 changed from POGO (#0) to 1 (#1) + Play#0 output Play#0 1 Efficiency of ssm V2 #12 changed from 0 to 10 + Play#0 output Play#0 1 ssm V2 #12 duplicated to (#13) + Play#0 output Play#0 1 ssm V2 #13 duplicated to (#14) + Play#0 output Play#0 1 ssm V2 #14 duplicated to (#15) + Play#0 output Play#0 6 0 640 Play#0 input edit p 2 e 1 Play#0 command edit Play#0 output Play#0 1 Efficiency of f1 Sopwith Camel #2 unchanged @@ -1514,6 +1523,46 @@ Play#0 command edit Play#0 output Play#0 1 Tech level of f1 Sopwith Camel #5 changed from 100 to 32767 Play#0 output Play#0 6 0 640 + Play#0 input edit p 2 F 0 + Play#0 command edit + Play#0 output Play#0 1 Fortification of f1 Sopwith Camel #2 unchanged + Play#0 output Play#0 6 0 640 + Play#0 input edit p 3 F -1 + Play#0 command edit + Play#0 output Play#0 1 Fortification of f1 Sopwith Camel #3 unchanged + Play#0 output Play#0 6 0 640 + Play#0 input edit p 4 F 0 + Play#0 command edit + Play#0 output Play#0 1 Fortification of f1 Sopwith Camel #4 unchanged + Play#0 output Play#0 6 0 640 + Play#0 input edit p 5 F 1 + Play#0 command edit + Play#0 output Play#0 1 Fortification of f1 Sopwith Camel #5 unchanged + Play#0 output Play#0 6 0 640 + Play#0 input edit p 12 F 1 + Play#0 command edit + Play#0 output Play#0 1 Fortification of ssm V2 #12 changed from 0 to 1 + Play#0 output Play#0 6 0 640 + Play#0 input edit p 12 F 0 + Play#0 command edit + Play#0 output Play#0 1 Fortification of ssm V2 #12 changed from 1 to 0 + Play#0 output Play#0 6 0 640 + Play#0 input edit p 13 F -1 + Play#0 command edit + Play#0 output Play#0 1 Fortification of ssm V2 #13 unchanged + Play#0 output Play#0 6 0 640 + Play#0 input edit p 14 F 126 + Play#0 command edit + Play#0 output Play#0 1 Fortification of ssm V2 #14 changed from 0 to 126 + Play#0 output Play#0 6 0 640 + Play#0 input edit p 14 F 127 + Play#0 command edit + Play#0 output Play#0 1 Fortification of ssm V2 #14 changed from 126 to 127 + Play#0 output Play#0 6 0 640 + Play#0 input edit p 15 F 128 + Play#0 command edit + Play#0 output Play#0 1 Fortification of ssm V2 #15 changed from 0 to 127 + Play#0 output Play#0 6 0 640 Play#0 input edit u 6 T art O 1 T art T hat g 12 T art Play#0 command edit Play#0 output Play#0 1 Type of cav cavalry #6 changed to art artillery @@ -2439,6 +2488,15 @@ Play#0 output Play#0 1 Type of f1 Sopwith Camel #8 changed to hb B-26B Marauder by an act of POGO Play#0 output Play#0 1 Range of hb B-26B Marauder #8 changed from 0 to 15 by an act of POGO Play#0 output Play#0 1 Type of hb B-26B Marauder #8 changed to f1 Sopwith Camel by an act of POGO + Play#0 output Play#0 1 ssm V2 #12 given to you by an act of POGO! + Play#0 output Play#0 1 ssm V2 #13 given to you by an act of POGO! + Play#0 output Play#0 1 ssm V2 #14 given to you by an act of POGO! + Play#0 output Play#0 1 ssm V2 #15 given to you by an act of POGO! + Play#0 output Play#0 1 Fortification of ssm V2 #12 changed from 0 to 1 by an act of POGO + Play#0 output Play#0 1 Fortification of ssm V2 #12 changed from 1 to 0 by an act of POGO + Play#0 output Play#0 1 Fortification of ssm V2 #14 changed from 0 to 126 by an act of POGO + Play#0 output Play#0 1 Fortification of ssm V2 #14 changed from 126 to 127 by an act of POGO + Play#0 output Play#0 1 Fortification of ssm V2 #15 changed from 0 to 127 by an act of POGO Play#0 output Play#0 1 art artillery #6 given to you by an act of POGO! Play#0 output Play#0 1 Type of art artillery #6 changed to hat hvy artillery by an act of POGO Play#0 output Play#0 1 POGO gave you 12 guns in hat hvy artillery #6