]> git.pond.sub.org Git - empserver/commitdiff
update: Delivery abandons sectors incorrectly, fix it not to
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 17 Jul 2016 08:55:31 +0000 (10:55 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 6 Aug 2017 18:09:17 +0000 (20:09 +0200)
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>
info/deliver.t
src/lib/update/deliver.c

index dc18adcb5a1149ff2510abfb1d21c1630340d61a..5b2c348f56edc3610635a6b9d1fb3abf3f523eba 100644 (file)
@@ -27,6 +27,9 @@ direction that a sector delivers to, then put a '+' before the number
 Note that delivery thresholds are stored as multiples of 8.  If you
 specify a threshold that is not a multiple of 8, it will be rounded down.
 .s1
+Delivery will not ship out the last civilian or the last military if
+there are no civilians, regardless of thresholds.
+.s1
 The direction must be specified as one of the six direction characters,
 (usually `y' `u' `j' `n' `b' or `g'), the \*Qno-direction\*U character,
 (usually `h').  If no direction is specified, then the direction will
index c55cd0becb160e589b945ec367b5593a9ee83c33..cace76eb637ecdf426ec29f7053f3035db4bb662 100644 (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