From 10f5000aa12ca243b8dd95e0967f5a5dcdd11ddf Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Thu, 13 May 2010 19:48:20 +0200 Subject: [PATCH] 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. --- src/lib/update/revolt.c | 10 ++++++++++ 1 file changed, 10 insertions(+) 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; -- 2.43.0