watchers sollten jetzt wieder ganze reports kriegen

This commit is contained in:
Enno Rehling 2002-05-05 10:26:33 +00:00
parent 63faa991bf
commit 372714f291
4 changed files with 23 additions and 2 deletions

View File

@ -1787,6 +1787,7 @@ lastregion (faction * f)
region *r = f->last; region *r = f->last;
if (!r && f->units) { if (!r && f->units) {
for (r = firstregion(f); r; r = r->next) { for (r = firstregion(f); r; r = r->next) {
plane * p = rplane(r);
unit *u; unit *u;
attrib *ru; attrib *ru;
for (u = r->units; u; u = u->next) { for (u = r->units; u; u = u->next) {
@ -1808,6 +1809,10 @@ lastregion (faction * f)
continue; continue;
if (check_leuchtturm(r, f)) if (check_leuchtturm(r, f))
f->last = r->next; f->last = r->next;
if (p && is_watcher(p, f)) {
f->first = r;
return r;
}
} }
} }
return f->last; return f->last;
@ -1823,6 +1828,7 @@ firstregion (faction * f)
for (r = regions; r; r = r->next) { for (r = regions; r; r = r->next) {
attrib *ru; attrib *ru;
unit *u; unit *u;
plane * p = rplane(r);
for (u = r->units; u; u = u->next) { for (u = r->units; u; u = u->next) {
if (u->faction == f) { if (u->faction == f) {
f->first = r; f->first = r;
@ -1842,6 +1848,10 @@ firstregion (faction * f)
f->first = r; f->first = r;
return r; return r;
} }
if (p && is_watcher(p, f)) {
f->first = r;
return r;
}
} }
f->first = regions; f->first = regions;
return regions; return regions;

View File

@ -255,3 +255,13 @@ read_plane_reference(plane ** pp, FILE * F)
if (*pp==NULL) ur_add((void*)i, (void**)pp, resolve_plane); if (*pp==NULL) ur_add((void*)i, (void**)pp, resolve_plane);
return AT_READ_OK; return AT_READ_OK;
} }
boolean
is_watcher(const struct plane * p, const struct faction * f)
{
struct watcher * w;
if (!p) return false;
w = p->watchers;
while (w && w->faction!=f) w=w->next;
return (w!=NULL);
}

View File

@ -71,7 +71,7 @@ void set_ursprung(struct faction *f, int id, int x, int y);
plane * create_new_plane(int id, const char *name, int minx, int maxx, int miny, int maxy, int flags); plane * create_new_plane(int id, const char *name, int minx, int maxx, int miny, int maxy, int flags);
plane * getplanebyname(const char *); plane * getplanebyname(const char *);
extern int rel_to_abs(const struct plane *pl, const struct faction * f, int rel, unsigned char index); extern int rel_to_abs(const struct plane *pl, const struct faction * f, int rel, unsigned char index);
extern boolean is_watcher(const struct plane * p, const struct faction * f);
extern void * resolve_plane(void * data); extern void * resolve_plane(void * data);
extern void write_plane_reference(const plane * p, FILE * F); extern void write_plane_reference(const plane * p, FILE * F);
extern int read_plane_reference(plane ** pp, FILE * F); extern int read_plane_reference(plane ** pp, FILE * F);

View File

@ -1917,12 +1917,13 @@ regatta_quest(void)
{ {
plane * p = getplanebyname("Regatta"); plane * p = getplanebyname("Regatta");
if (p) { if (p) {
fset(p, PFL_NOMONSTERS);
fset(p, PFL_SEESPECIAL); fset(p, PFL_SEESPECIAL);
return resize_plane(p, 40); return resize_plane(p, 40);
#ifdef REGATTA_QUESTMASTER /* "gregorjochmann@gmx.de" */ #ifdef REGATTA_QUESTMASTER /* "gregorjochmann@gmx.de" */
} else { } else {
region * center; region * center;
p = gm_addplane(40, PFL_NORECRUITS, "Regatta"); p = gm_addplane(40, PFL_NORECRUITS|PFL_NOMONSTERS|PFL_SEESPECIAL, "Regatta");
center = findregion(p->minx+(p->maxx-p->minx)/2, p->miny+(p->maxy-p->miny)/2); center = findregion(p->minx+(p->maxx-p->minx)/2, p->miny+(p->maxy-p->miny)/2);
gm_addfaction(REGATTA_QUESTMASTER, p, center); gm_addfaction(REGATTA_QUESTMASTER, p, center);
#endif #endif