fix neighbor seen_region collection.

This commit is contained in:
Enno Rehling 2015-09-09 10:22:04 +02:00
parent 42e51a0ec4
commit 7f9e84d68b

View file

@ -1513,15 +1513,19 @@ static region *firstregion(faction * f)
#endif #endif
} }
static void view_region(region *r, faction *f) { static void cb_view_neighbours(seen_region *sr, void *cbdata) {
plane *p = rplane(r); faction *f = (faction *)cbdata;
void(*view) (struct seen_region **, region *, faction *) = view_default; if (sr->mode > see_neighbour) {
region *r = sr->r;
plane *p = rplane(r);
void(*view) (struct seen_region **, region *, faction *) = view_default;
if (p && fval(p, PFL_SEESPECIAL)) { if (p && fval(p, PFL_SEESPECIAL)) {
/* TODO: this is not very customizable */ /* TODO: this is not very customizable */
view = (strcmp(p->name, "Regatta") == 0) ? view_regatta : view_neighbours; view = (strcmp(p->name, "Regatta") == 0) ? view_regatta : view_neighbours;
}
view(f->seen, r, f);
} }
view(f->seen, r, f);
} }
void prepare_seen(faction *f) void prepare_seen(faction *f)
@ -1533,12 +1537,7 @@ void prepare_seen(faction *f)
sr = find_seen(f->seen, r); sr = find_seen(f->seen, r);
} }
for (; sr != NULL; sr = sr->next) { seenhash_map(f->seen, cb_view_neighbours, f);
if (sr->mode > see_neighbour) {
region *r = sr->r;
view_region(r, f);
}
}
get_seen_interval(f->seen, &f->first, &f->last); get_seen_interval(f->seen, &f->first, &f->last);
link_seen(f->seen, f->first, f->last); link_seen(f->seen, f->first, f->last);
} }