march: Fix check for sector abandonment
sct_prewrite() makes an owned sector revert to the deity when there
are no civilians, military or own land units.
would_abandon() tries to predict that, but gets it wrong: it ignores
land units that evade spy detection or are loaded on ships, and it
fails to ignore land units loaded on land units marching out.
Broken in commit 7c1b166
, v4.3.33. Fix by counting manually rather
than with unitsatxy().
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
bd9fbca995
commit
7224442533
3 changed files with 38 additions and 9 deletions
|
@ -29,7 +29,7 @@
|
|||
* Known contributors to this file:
|
||||
* Dave Pare, 1989
|
||||
* Steve McClure, 1996
|
||||
* Markus Armbruster, 2004-2014
|
||||
* Markus Armbruster, 2004-2016
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
@ -83,9 +83,12 @@ sct_prewrite(int id, void *old, void *new)
|
|||
sp->sct_oldown = own;
|
||||
}
|
||||
|
||||
/*
|
||||
* Without civilians, military and land units, revert to deity.
|
||||
* Note: would_abandon() must match this condition.
|
||||
*/
|
||||
if (own && !civs && !mil && !has_units(sp->sct_x, sp->sct_y, own)
|
||||
&& !(sp->sct_flags & MOVE_IN_PROGRESS)) {
|
||||
/* more cruft! */
|
||||
own = sp->sct_own = 0;
|
||||
sp->sct_mobil = 0;
|
||||
if (sp->sct_type == SCT_CAPIT || sp->sct_type == SCT_MOUNT)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue