far_vision test uses watch_region, checkes faction.interval

This commit is contained in:
Enno Rehling 2016-09-24 21:09:15 +02:00
parent de58fa6aa0
commit 4353773c3b
3 changed files with 11 additions and 4 deletions

View file

@ -6,6 +6,7 @@
#include "lighthouse.h" #include "lighthouse.h"
#include "travelthru.h" #include "travelthru.h"
#include "keyword.h" #include "keyword.h"
#include "spells.h"
#include <kernel/building.h> #include <kernel/building.h>
#include <kernel/faction.h> #include <kernel/faction.h>
@ -426,7 +427,7 @@ static void test_seen_travelthru(CuTest *tc) {
} }
static void test_report_far_vision(CuTest *tc) { static void test_report_far_vision(CuTest *tc) {
unit *u1, *u2; unit *u1;
faction *f; faction *f;
region *r1, *r2; region *r1, *r2;
const race *rc; const race *rc;
@ -436,8 +437,9 @@ static void test_report_far_vision(CuTest *tc) {
u1 = test_create_unit(f, r1); u1 = test_create_unit(f, r1);
r2 = test_create_region(10, 0, 0); r2 = test_create_region(10, 0, 0);
rc = test_create_race("spell"); rc = test_create_race("spell");
u2 = create_unit(r2, u1->faction, 1, rc, 0, "spell/dreamreading", NULL); watch_region(r2, f, 10);
set_number(u2, 1); CuAssertPtrEquals(tc, r1, f->first);
CuAssertPtrEquals(tc, r2, f->last);
report_context ctx; report_context ctx;
prepare_report(&ctx, f); prepare_report(&ctx, f);
CuAssertPtrEquals(tc, r1, ctx.first); CuAssertPtrEquals(tc, r1, ctx.first);

View file

@ -4111,7 +4111,8 @@ static int sp_bigrecruit(castorder * co)
return cast_level; return cast_level;
} }
static void watch_region(region *r, faction *f, int perception) { void watch_region(region *r, faction *f, int perception)
{
unit *u; unit *u;
u = create_unit(r, f, 1, get_race(RC_SPELL), 0, NULL, NULL); u = create_unit(r, f, 1, get_race(RC_SPELL), 0, NULL, NULL);

View file

@ -25,10 +25,14 @@ extern "C" {
struct ship; struct ship;
struct curse; struct curse;
struct unit; struct unit;
struct faction;
struct region;
struct message; struct message;
void register_spells(void); void register_spells(void);
void watch_region(struct region *r, struct faction *f, int perception);
int sp_baddreams(castorder * co); int sp_baddreams(castorder * co);
int sp_gooddreams(castorder * co); int sp_gooddreams(castorder * co);