Merge branch 'master' into develop

This commit is contained in:
Enno Rehling 2021-06-14 22:00:39 +02:00
commit 6244c6c437
2 changed files with 4 additions and 4 deletions

View File

@ -3609,9 +3609,9 @@ bool long_order_allowed(const unit *u, bool flags_only)
*/
return false;
}
if (flags_only) return true;
if (fval(r->terrain, SEA_REGION) && !(u_race(u)->flags & RCF_SWIM)) {
if (flags_only) return false;
else if (u_race(u) != get_race(RC_AQUARIAN)) {
if (u_race(u) != get_race(RC_AQUARIAN)) {
/* error message disabled by popular demand */
return false;
}

View File

@ -1997,6 +1997,7 @@ static void test_long_order_on_ocean(CuTest *tc) {
test_setup();
rc = test_create_race("pikachu");
u = test_create_unit(test_create_faction_ex(rc, NULL), test_create_ocean(0, 0));
CuAssertTrue(tc, long_order_allowed(u, true));
CuAssertTrue(tc, !long_order_allowed(u, false));
rc->flags |= RCF_SWIM;
CuAssertTrue(tc, long_order_allowed(u, false));
@ -2007,11 +2008,10 @@ static void test_long_order_on_ocean(CuTest *tc) {
rc = test_create_race("aquarian");
u = test_create_unit(test_create_faction_ex(rc, NULL), u->region);
CuAssertTrue(tc, long_order_allowed(u, false));
CuAssertTrue(tc, !long_order_allowed(u, true));
CuAssertTrue(tc, long_order_allowed(u, true));
u->faction->flags |= FFL_PAUSED;
CuAssertTrue(tc, !long_order_allowed(u, true));
CuAssertTrue(tc, !long_order_allowed(u, false));
u->faction->flags -= FFL_PAUSED;
test_teardown();
}