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:
Markus Armbruster 2018-05-11 07:58:34 +02:00
parent f5514cb452
commit 8b9ce7be43
4 changed files with 8 additions and 6 deletions

View 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 *

View 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 *