forked from github/server
This commit is contained in:
parent
67025b65d0
commit
ddd37688f9
3 changed files with 5 additions and 6 deletions
|
@ -61,7 +61,7 @@ static int obs_age(struct attrib *a, void *owner)
|
||||||
|
|
||||||
UNUSED_ARG(owner);
|
UNUSED_ARG(owner);
|
||||||
update_interval(od->f, (region *)owner);
|
update_interval(od->f, (region *)owner);
|
||||||
return --od->timer;
|
return --od->timer > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void obs_write(const variant *var, const void *owner,
|
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
|
"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);
|
attrib * a = a_new(&at_observer);
|
||||||
obs_data *od = (obs_data *)a->data.v;
|
obs_data *od = (obs_data *)a->data.v;
|
||||||
od->f = f;
|
od->f = f;
|
||||||
od->skill = perception;
|
od->skill = perception;
|
||||||
od->timer = 2;
|
od->timer = timer;
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ void set_observer(region *r, faction *f, int skill, int turns)
|
||||||
else {
|
else {
|
||||||
fset(r, RF_OBSERVER);
|
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 = {
|
attrib_type at_unitdissolve = {
|
||||||
|
|
|
@ -1000,7 +1000,6 @@ int stealth_modifier(const region *r, const faction *f, seen_mode mode)
|
||||||
case seen_unit:
|
case seen_unit:
|
||||||
return 0;
|
return 0;
|
||||||
case seen_lighthouse:
|
case seen_lighthouse:
|
||||||
return -2;
|
|
||||||
case seen_travel:
|
case seen_travel:
|
||||||
return -1;
|
return -1;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -164,7 +164,7 @@ static void test_view_reality(CuTest *tc) {
|
||||||
CuAssertIntEquals(tc, -1, get_observer(rx, f));
|
CuAssertIntEquals(tc, -1, get_observer(rx, f));
|
||||||
free_castorder(&co);
|
free_castorder(&co);
|
||||||
|
|
||||||
set_observer(r, f, -1, -1);
|
set_observer(r, f, -1, 0);
|
||||||
CuAssertIntEquals(tc, -1, get_observer(r, f));
|
CuAssertIntEquals(tc, -1, get_observer(r, f));
|
||||||
|
|
||||||
/* target region r exists, but astral space is blocked */
|
/* target region r exists, but astral space is blocked */
|
||||||
|
|
Loading…
Reference in a new issue