From: Markus Armbruster Date: Thu, 13 May 2010 17:48:20 +0000 (+0200) Subject: Fix che revolt to damage only land units that actually fight X-Git-Tag: v4.3.26~8 X-Git-Url: http://git.pond.sub.org/?p=empserver;a=commitdiff_plain;h=10f5000aa12ca243b8dd95e0967f5a5dcdd11ddf Fix che revolt to damage only land units that actually fight guerrilla() lets only the sector owner's land units fight. But take_casualties() spread the casualties among all land units in the sector. Thus, defending land units could survive a defeat if foreign land units were present. The sector takeover then had che capture them, or their crews blow them up. The foreign land units were damaged silently. --- diff --git a/src/lib/update/revolt.c b/src/lib/update/revolt.c index da8b22849..f8aef8dc0 100644 --- a/src/lib/update/revolt.c +++ b/src/lib/update/revolt.c @@ -439,6 +439,8 @@ take_casualties(struct sctstr *sp, int mc) */ snxtitem_xy(&ni, EF_LAND, sp->sct_x, sp->sct_y); while (NULL != (lp = nxtitemp(&ni))) { + if (lp->lnd_own != sp->sct_own) + continue; nunits++; if (lchr[(int)lp->lnd_type].l_flags & L_SECURITY) nunits++; @@ -452,6 +454,8 @@ take_casualties(struct sctstr *sp, int mc) /* kill some security troops */ snxtitem_xy(&ni, EF_LAND, sp->sct_x, sp->sct_y); while (NULL != (lp = nxtitemp(&ni))) { + if (lp->lnd_own != sp->sct_own) + continue; if (!(lchr[(int)lp->lnd_type].l_flags & L_SECURITY)) continue; @@ -477,6 +481,8 @@ take_casualties(struct sctstr *sp, int mc) /* kill some normal troops */ snxtitem_xy(&ni, EF_LAND, sp->sct_x, sp->sct_y); while (NULL != (lp = nxtitemp(&ni))) { + if (lp->lnd_own != sp->sct_own) + continue; if (lchr[(int)lp->lnd_type].l_flags & L_SECURITY) continue; @@ -503,6 +509,8 @@ take_casualties(struct sctstr *sp, int mc) /* kill some normal troops */ snxtitem_xy(&ni, EF_LAND, sp->sct_x, sp->sct_y); while (NULL != (lp = nxtitemp(&ni))) { + if (lp->lnd_own != sp->sct_own) + continue; if (lchr[(int)lp->lnd_type].l_flags & L_SECURITY) continue; @@ -521,6 +529,8 @@ take_casualties(struct sctstr *sp, int mc) /* kill some security troops */ snxtitem_xy(&ni, EF_LAND, sp->sct_x, sp->sct_y); while (NULL != (lp = nxtitemp(&ni))) { + if (lp->lnd_own != sp->sct_own) + continue; if (!(lchr[(int)lp->lnd_type].l_flags & L_SECURITY)) continue;