PAusierte Parteien: HELFE BEWACHE bleibt erhalten.

This commit is contained in:
Enno Rehling 2021-05-22 12:45:34 +02:00
parent e0d6bb410e
commit a3916b8271
2 changed files with 8 additions and 5 deletions

View File

@ -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;

View File

@ -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();
}