]> git.pond.sub.org Git - empserver/commitdiff
subs: Maintain plane and land unit fortification invariant
authorMarkus Armbruster <armbru@pond.sub.org>
Fri, 11 May 2018 05:58:34 +0000 (07:58 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Tue, 5 Jan 2021 09:40:34 +0000 (10:40 +0100)
Make lnd_prewrite() and pln_prewrite() ensure that land units and
missiles loaded on a land unit or ship are never fortified / hardened.

This takes care of edit neglecting to zap fortification on load.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
src/lib/subs/land.c
src/lib/subs/plane.c
tests/actofgod/final.xdump
tests/actofgod/geninput.pl

index 034393a52e3dc04998c2fb07ce9952aa017fe7cd..e56846f69439531b33c86e96056d33f40681b671 100644 (file)
@@ -28,7 +28,7 @@
  *
  *  Known contributors to this file:
  *     Steve McClure, 1996
- *     Markus Armbruster, 2004-2016
+ *     Markus Armbruster, 2004-2018
  */
 
 #include <config.h>
@@ -95,6 +95,8 @@ lnd_prewrite(int n, void *old, void *new)
     lp->lnd_land = land;
     if (!own || lp->lnd_x != oldlp->lnd_x || lp->lnd_y != oldlp->lnd_y)
        unit_update_cargo((struct empobj *)lp);
+    if (ship >= 0 || land >= 0)
+       lp->lnd_harden = 0;
 }
 
 char *
index 21f3f3dfcdde445dacd02d934e36d493d7159b04..076dc887f3b4e2b5155eff9c84c84119fd413059 100644 (file)
@@ -29,7 +29,7 @@
  *  Known contributors to this file:
  *     Dave Pare, 1989
  *     Steve McClure, 1996
- *     Markus Armbruster, 2006-2016
+ *     Markus Armbruster, 2006-2018
  */
 
 #include <config.h>
@@ -95,6 +95,8 @@ pln_prewrite(int n, void *old, void *new)
     pp->pln_land = land;
     if (!own || pp->pln_x != oldpp->pln_x || pp->pln_y != oldpp->pln_y)
        unit_update_cargo((struct empobj *)pp);
+    if (ship >= 0 || land >= 0)
+       pp->pln_harden = 0;
 }
 
 char *
index 34ac59b53ec0c61ba065d365e7ee088b5a4d9b39..302ec83467f534eb0ba5c4a6d50ee880ab2a291c 100644 (file)
@@ -191,7 +191,7 @@ uid owner xloc yloc type effic mobil off tech opx opy mission radius wing range
 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 1 -1 28 10 0 0 145 1 -1 none 0 "" 0 127 4 -1 () 0 0.00000
+14 1 1 -1 28 10 0 0 145 1 -1 none 0 "" 0 0 4 -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
@@ -201,7 +201,7 @@ uid owner xloc yloc type effic mobil off tech opx opy mission radius army ship h
 1 98 1 -1 6 10 0 0 100 0 0 none 0 "" -1 0 42 () "" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
 2 2 3 -1 6 10 -127 0 50 0 0 none 0 "" -1 0 0 (group) "" 0 1 1 1 1 1 1 1 1 0 1 1 0 0 healthy 0 -1 0
 3 3 1 -1 6 10 -127 0 50 0 0 none 0 "a" 3 0 0 (injured) "jj" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
-4 3 3 -1 6 100 127 0 32767 0 0 none 0 "" 2 127 100 () "" 0 25 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
+4 3 3 -1 6 100 127 0 32767 0 0 none 0 "" 2 0 100 () "" 0 25 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
 5 3 1 -1 6 100 127 0 32767 0 0 none 0 "" -1 127 100 () "" 0 25 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
 6 1 0 0 11 10 0 0 100 0 0 none 0 "" -1 0 0 () "" 0 0 0 10 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
 49 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 0 0 () "" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
index ce595139f7c008e9f453a3ff2cc3fa3487f231b0..a6e0f9d978de638cafcdef325bb85ed74b4e2b75 100755 (executable)
@@ -343,11 +343,9 @@ edit('plane', 4, 'l', '5,1');
 
 # special case: load teleports to carrier
 # (previous loads already zapped fortification)
-# BUG: fortification not zapped
 edit('land', 4, 'S', 2);
 
 # special case: load teleports to carrier and zaps fortification
-# BUG: fortification not zapped
 edit('plane', 14, 's', 4);
 
 # interactive edit