diff --git a/src/reports.test.c b/src/reports.test.c index d5801ebab..91e052683 100644 --- a/src/reports.test.c +++ b/src/reports.test.c @@ -6,6 +6,7 @@ #include "lighthouse.h" #include "travelthru.h" #include "keyword.h" +#include "spells.h" #include #include @@ -426,7 +427,7 @@ static void test_seen_travelthru(CuTest *tc) { } static void test_report_far_vision(CuTest *tc) { - unit *u1, *u2; + unit *u1; faction *f; region *r1, *r2; const race *rc; @@ -436,8 +437,9 @@ static void test_report_far_vision(CuTest *tc) { u1 = test_create_unit(f, r1); r2 = test_create_region(10, 0, 0); rc = test_create_race("spell"); - u2 = create_unit(r2, u1->faction, 1, rc, 0, "spell/dreamreading", NULL); - set_number(u2, 1); + watch_region(r2, f, 10); + CuAssertPtrEquals(tc, r1, f->first); + CuAssertPtrEquals(tc, r2, f->last); report_context ctx; prepare_report(&ctx, f); CuAssertPtrEquals(tc, r1, ctx.first); diff --git a/src/spells.c b/src/spells.c index ce0a8d980..b14b588ee 100644 --- a/src/spells.c +++ b/src/spells.c @@ -4111,7 +4111,8 @@ static int sp_bigrecruit(castorder * co) return cast_level; } -static void watch_region(region *r, faction *f, int perception) { +void watch_region(region *r, faction *f, int perception) +{ unit *u; u = create_unit(r, f, 1, get_race(RC_SPELL), 0, NULL, NULL); diff --git a/src/spells.h b/src/spells.h index 1ad68e131..c10ee1c6c 100644 --- a/src/spells.h +++ b/src/spells.h @@ -25,10 +25,14 @@ extern "C" { struct ship; struct curse; struct unit; + struct faction; + struct region; struct message; void register_spells(void); + void watch_region(struct region *r, struct faction *f, int perception); + int sp_baddreams(castorder * co); int sp_gooddreams(castorder * co);