From a3916b8271e4d8dd23c475b59707a1fcbce446ca Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 22 May 2021 12:45:34 +0200 Subject: [PATCH] PAusierte Parteien: HELFE BEWACHE bleibt erhalten. --- src/kernel/ally.c | 9 ++++++--- src/kernel/ally.test.c | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/kernel/ally.c b/src/kernel/ally.c index b2796032f..695d71738 100644 --- a/src/kernel/ally.c +++ b/src/kernel/ally.c @@ -308,10 +308,13 @@ alliedgroup(const struct faction *f, allies *all = g ? g->allies : f->allies; int status; - if (is_paused(f) || (!(faction_alive(f) && faction_alive(f2)))) { + if (!(faction_alive(f) && faction_alive(f2))) { return 0; } status = ally_get(all, f2) & mask; + if (is_paused(f)) { + status &= HELP_GUARD; + } return alliance_status(f, f2, status); } @@ -329,8 +332,8 @@ int alliedunit(const unit * u, const faction * f2, int mask) if (u->faction == f2) { return mask; } - if (is_paused(u->faction) || !faction_alive(f2)) { - return 0; + if (!faction_alive(f2)) { + return mask; } if (u->faction != NULL && f2 != NULL) { group *g; diff --git a/src/kernel/ally.test.c b/src/kernel/ally.test.c index 9be916b3c..8eec67048 100644 --- a/src/kernel/ally.test.c +++ b/src/kernel/ally.test.c @@ -79,7 +79,7 @@ static void test_alliedfaction(CuTest *tc) { ally_set(&f1->allies, f2, HELP_ALL); CuAssertIntEquals(tc, HELP_ALL, alliedfaction(f1, f2, HELP_ALL)); f1->flags |= FFL_PAUSED; - CuAssertIntEquals(tc, 0, alliedfaction(f1, f2, HELP_ALL)); + CuAssertIntEquals(tc, HELP_GUARD, alliedfaction(f1, f2, HELP_ALL)); test_teardown(); } @@ -98,7 +98,7 @@ static void test_alliedunit(CuTest *tc) { ally_set(&f1->allies, f2, HELP_ALL); CuAssertIntEquals(tc, HELP_ALL, alliedunit(u, f2, HELP_ALL)); f1->flags |= FFL_PAUSED; - CuAssertIntEquals(tc, 0, alliedunit(u, f2, HELP_ALL)); + CuAssertIntEquals(tc, HELP_GUARD, alliedunit(u, f2, HELP_ALL)); test_teardown(); }