Skip to content

Commit

Permalink
reproduce the bug
Browse files Browse the repository at this point in the history
add an optimization to the spell, too
  • Loading branch information
ennorehling committed Nov 4, 2024
1 parent d657dfb commit 9302d02
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
17 changes: 17 additions & 0 deletions src/laws.test.c
Original file line number Diff line number Diff line change
Expand Up @@ -2247,6 +2247,22 @@ static void test_cansee_empty(CuTest *tc) {
test_teardown();
}

static void test_cansee_skillmod(CuTest *tc) {
unit *u;
faction *f;

test_setup();
f = test_create_faction();
u = test_create_unit(test_create_faction(), test_create_plain(0, 0));

CuAssertTrue(tc, cansee(f, u->region, u, 0)); /* can see even if using spell with no modifier */
set_level(u, SK_STEALTH, 1);
CuAssertTrue(tc, !cansee(f, u->region, u, 0));
CuAssertTrue(tc, cansee(f, u->region, u, 1));

test_teardown();
}


/**
* Hidden monsters are seen in oceans if they are big enough.
Expand Down Expand Up @@ -3008,6 +3024,7 @@ CuSuite *get_laws_suite(void)
SUITE_ADD_TEST(suite, test_cansee_guard);
SUITE_ADD_TEST(suite, test_cansee_temp);
SUITE_ADD_TEST(suite, test_cansee_empty);
SUITE_ADD_TEST(suite, test_cansee_skillmod);
SUITE_ADD_TEST(suite, test_nmr_timeout);
SUITE_ADD_TEST(suite, test_long_orders);
SUITE_ADD_TEST(suite, test_long_order_on_ocean);
Expand Down
4 changes: 3 additions & 1 deletion src/spells.c
Original file line number Diff line number Diff line change
Expand Up @@ -4042,8 +4042,10 @@ int sp_pump(castorder * co)
}

for (u = rt->units; u; u = u->next) {
if (u->faction == target->faction)
if (u->faction == target->faction) {
see = true;
break;
}
}

if (see) {
Expand Down

0 comments on commit 9302d02

Please sign in to comment.