]> git.pond.sub.org Git - empserver/commitdiff
subs/control: Fix to ignore embarked land units
authorMarkus Armbruster <armbru@pond.sub.org>
Mon, 19 Sep 2016 18:35:30 +0000 (20:35 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 6 Aug 2017 18:09:20 +0000 (20:09 +0200)
Moving stuff out of an occupied sector generally requires "military
control", i.e. you need at least one military for every ten civilians.
Military in land units count.  Even when the land unit is loaded on a
ship or land unit.  Questionable, because unload need not be possible.

Checking whether unload would be possible is not worth the trouble
here, simply ignore embarked land units.

This affects commands move, explore, sell, set and transport, as well
as the update's distribution and delivery.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
src/lib/subs/control.c

index c5f083e02944bfdfddc7879a54dca1466fa2f5e5..a067dae7db5a48589edd890b15c68ddc10a4b7d5 100644 (file)
@@ -85,6 +85,8 @@ military_control(struct sctstr *sp)
     if (sp->sct_oldown != sp->sct_own) {
        snxtitem_xy(&ni, EF_LAND, sp->sct_x, sp->sct_y);
        while (nxtitem(&ni, &land)) {
     if (sp->sct_oldown != sp->sct_own) {
        snxtitem_xy(&ni, EF_LAND, sp->sct_x, sp->sct_y);
        while (nxtitem(&ni, &land)) {
+           if (land.lnd_ship >= 0 || land.lnd_land >= 0)
+               continue;
            if (land.lnd_own == sp->sct_own)
                tot_mil += land.lnd_item[I_MILIT];
        }
            if (land.lnd_own == sp->sct_own)
                tot_mil += land.lnd_item[I_MILIT];
        }