From: Markus Armbruster Date: Mon, 19 Sep 2016 18:27:19 +0000 (+0200) Subject: convert shoot: Fix to ignore foreign and embarked land units X-Git-Tag: v4.4.0~101 X-Git-Url: http://git.pond.sub.org/?p=empserver;a=commitdiff_plain;h=986df4e2ab27e20598a2d5ff41dedb3721161028 convert shoot: Fix to ignore foreign and embarked land units Convert and shoot put land units to work regardless of ownership. Clearly wrong for foreign, non-allied land units trapped in the sector. They also happily use land units loaded on ships or land units, unlike most other commands. Questionable, because unload need not be possible. Checking for ownership and load status was neglected when land units were added in Chainsaw 3. Non-allied land units became possible in 4.0.0. Checking relations and whether unload would be possible is not worth the trouble here, simply ignore all foreign and embarked land units. Signed-off-by: Markus Armbruster --- diff --git a/src/lib/subs/control.c b/src/lib/subs/control.c index a2df3a3f7..c5f083e02 100644 --- a/src/lib/subs/control.c +++ b/src/lib/subs/control.c @@ -57,6 +57,10 @@ security_strength(struct sctstr *sp, int *seceffp) seceff = 0; snxtitem_xy(&ni, EF_LAND, sp->sct_x, sp->sct_y); while (nxtitem(&ni, &land)) { + if (land.lnd_own != sp->sct_own) + continue; + if (land.lnd_ship >= 0 || land.lnd_land >= 0) + continue; strength += land.lnd_item[I_MILIT]; if (lchr[land.lnd_type].l_flags & L_SECURITY) { strength += land.lnd_item[I_MILIT] * land.lnd_effic / 100.0;