subs: Maintain plane and land unit fortification invariant
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>
This commit is contained in:
parent
f5514cb452
commit
8b9ce7be43
4 changed files with 8 additions and 6 deletions
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* Known contributors to this file:
|
* Known contributors to this file:
|
||||||
* Steve McClure, 1996
|
* Steve McClure, 1996
|
||||||
* Markus Armbruster, 2004-2016
|
* Markus Armbruster, 2004-2018
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
@ -95,6 +95,8 @@ lnd_prewrite(int n, void *old, void *new)
|
||||||
lp->lnd_land = land;
|
lp->lnd_land = land;
|
||||||
if (!own || lp->lnd_x != oldlp->lnd_x || lp->lnd_y != oldlp->lnd_y)
|
if (!own || lp->lnd_x != oldlp->lnd_x || lp->lnd_y != oldlp->lnd_y)
|
||||||
unit_update_cargo((struct empobj *)lp);
|
unit_update_cargo((struct empobj *)lp);
|
||||||
|
if (ship >= 0 || land >= 0)
|
||||||
|
lp->lnd_harden = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
* Known contributors to this file:
|
* Known contributors to this file:
|
||||||
* Dave Pare, 1989
|
* Dave Pare, 1989
|
||||||
* Steve McClure, 1996
|
* Steve McClure, 1996
|
||||||
* Markus Armbruster, 2006-2016
|
* Markus Armbruster, 2006-2018
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
@ -95,6 +95,8 @@ pln_prewrite(int n, void *old, void *new)
|
||||||
pp->pln_land = land;
|
pp->pln_land = land;
|
||||||
if (!own || pp->pln_x != oldpp->pln_x || pp->pln_y != oldpp->pln_y)
|
if (!own || pp->pln_x != oldpp->pln_x || pp->pln_y != oldpp->pln_y)
|
||||||
unit_update_cargo((struct empobj *)pp);
|
unit_update_cargo((struct empobj *)pp);
|
||||||
|
if (ship >= 0 || land >= 0)
|
||||||
|
pp->pln_harden = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
|
|
|
@ -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
|
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
|
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
|
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
|
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
|
49 0 0 0 0 0 0 0 0 0 0 none 0 "" 0 0 -1 -1 () 0 0.00000
|
||||||
/config
|
/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
|
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
|
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
|
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
|
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
|
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
|
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
|
||||||
|
|
|
@ -343,11 +343,9 @@ edit('plane', 4, 'l', '5,1');
|
||||||
|
|
||||||
# special case: load teleports to carrier
|
# special case: load teleports to carrier
|
||||||
# (previous loads already zapped fortification)
|
# (previous loads already zapped fortification)
|
||||||
# BUG: fortification not zapped
|
|
||||||
edit('land', 4, 'S', 2);
|
edit('land', 4, 'S', 2);
|
||||||
|
|
||||||
# special case: load teleports to carrier and zaps fortification
|
# special case: load teleports to carrier and zaps fortification
|
||||||
# BUG: fortification not zapped
|
|
||||||
edit('plane', 14, 's', 4);
|
edit('plane', 14, 's', 4);
|
||||||
|
|
||||||
# interactive edit
|
# interactive edit
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue