Enno Rehling 2020-12-10 11:58:52 +01:00
parent 67025b65d0
commit ddd37688f9
3 changed files with 5 additions and 6 deletions

View file

@ -61,7 +61,7 @@ static int obs_age(struct attrib *a, void *owner)
UNUSED_ARG(owner);
update_interval(od->f, (region *)owner);
return --od->timer;
return --od->timer > 0;
}
static void obs_write(const variant *var, const void *owner,
@ -90,13 +90,13 @@ attrib_type at_observer = {
"observer", obs_init, a_free_voidptr, obs_age, obs_write, obs_read
};
static attrib *make_observer(faction *f, int perception)
static attrib *make_observer(faction *f, int perception, int timer)
{
attrib * a = a_new(&at_observer);
obs_data *od = (obs_data *)a->data.v;
od->f = f;
od->skill = perception;
od->timer = 2;
od->timer = timer;
return a;
}
@ -132,7 +132,7 @@ void set_observer(region *r, faction *f, int skill, int turns)
else {
fset(r, RF_OBSERVER);
}
a_add(&r->attribs, make_observer(f, skill));
a_add(&r->attribs, make_observer(f, skill, turns));
}
attrib_type at_unitdissolve = {

View file

@ -1000,7 +1000,6 @@ int stealth_modifier(const region *r, const faction *f, seen_mode mode)
case seen_unit:
return 0;
case seen_lighthouse:
return -2;
case seen_travel:
return -1;
default:

View file

@ -164,7 +164,7 @@ static void test_view_reality(CuTest *tc) {
CuAssertIntEquals(tc, -1, get_observer(rx, f));
free_castorder(&co);
set_observer(r, f, -1, -1);
set_observer(r, f, -1, 0);
CuAssertIntEquals(tc, -1, get_observer(r, f));
/* target region r exists, but astral space is blocked */