update: Delivery abandons sectors incorrectly, fix it not to

Deliver fails to abandon sectors when it ships out all civilians and
military.  The sector remains owned until the next non-update sector
update abandons it.  Has always been broken.

Distribution had the same bug until commit d0f3847 (v4.3.20) fixed it.
Fix it the same way for delivery: adjust the amount moved to avoid
moving out the last civilian, or the last military if there are no
civilians.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2016-07-17 10:55:31 +02:00
parent 43a0a4a451
commit 9a2e1ccd6c
2 changed files with 7 additions and 1 deletions

View file

@ -27,7 +27,7 @@
* deliver.c: Deliver commodities to neighboring sector
*
* Known contributors to this file:
*
* Markus Armbruster, 2004-2016
*/
#include <config.h>
@ -89,6 +89,9 @@ deliver(struct sctstr *from, struct ichrstr *ip, int dir,
return 0;
}
}
/* make sure not to abandon the sector */
if (vtype == I_CIVIL || (vtype == I_MILIT && !to->sct_item[I_CIVIL]))
amt_moved--;
/*
* disallow delivery into prohibited sectors.
* calculate unit movement cost; decrease amount if