at_gm fuer gm-parteien. ungetestet, aber eher nciht kritisch

This commit is contained in:
Enno Rehling 2001-02-17 14:47:43 +00:00
parent 17de588110
commit da39fd2182
4 changed files with 60 additions and 7 deletions

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: eressea.c,v 1.15 2001/02/15 02:41:46 enno Exp $ * $Id: eressea.c,v 1.16 2001/02/17 14:47:42 enno Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -24,6 +24,7 @@
/* attributes includes */ /* attributes includes */
#include <attributes/reduceproduction.h> #include <attributes/reduceproduction.h>
#include <attributes/gm.h>
/* kernel includes */ /* kernel includes */
#include "message.h" #include "message.h"
@ -695,11 +696,18 @@ int
isallied(const plane * pl, const faction * f, const faction * f2, int mode) isallied(const plane * pl, const faction * f, const faction * f2, int mode)
{ {
ally *sf; ally *sf;
attrib * a;
if (f == f2) if (f == f2) return mode;
return mode;
if (f2==NULL) return 0; if (f2==NULL) return 0;
a = a_find(f->attribs, &at_gm);
while (a) {
plane * p = (plane*)a->data.v;
if (p==pl) return mode;
a=a->next;
}
if (pl && pl->flags & PFL_FRIENDLY) return mode; if (pl && pl->flags & PFL_FRIENDLY) return mode;
if (mode != HELP_GIVE && pl && (pl->flags & PFL_NOALLIANCES)) return 0; if (mode != HELP_GIVE && pl && (pl->flags & PFL_NOALLIANCES)) return 0;
for (sf = f->allies; sf; sf = sf->next) for (sf = f->allies; sf; sf = sf->next)

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: plane.c,v 1.2 2001/01/26 16:19:40 enno Exp $ * $Id: plane.c,v 1.3 2001/02/17 14:47:42 enno Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -27,6 +27,9 @@
#include "region.h" #include "region.h"
#include "faction.h" #include "faction.h"
/* util includes */
#include <resolve.h>
/* libc includes */ /* libc includes */
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
@ -225,3 +228,28 @@ rel_to_abs(struct plane *pl, struct faction * f, int rel, unsigned char index)
return (rel + ursprung_y(f,pl)); return (rel + ursprung_y(f,pl));
} }
void *
resolve_plane(void * id)
{
return getplanebyid((int)id);
}
void
write_plane_reference(const plane * u, FILE * F)
{
fprintf(F, "%d ", u?(u->id):0);
}
void
read_plane_reference(plane ** up, FILE * F)
{
int i;
fscanf(F, "%d", &i);
if (i==0) *up = NULL;
{
*up = getplanebyid(i);
if (*up==NULL) ur_add((void*)i, (void**)&up, resolve_plane);
}
}

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: plane.h,v 1.3 2001/02/05 16:11:58 enno Exp $ * $Id: plane.h,v 1.4 2001/02/17 14:47:42 enno Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -44,7 +44,7 @@ typedef struct plane {
char *name; char *name;
int minx,maxx,miny,maxy; int minx,maxx,miny,maxy;
unsigned int flags; unsigned int flags;
attrib *attribs; struct attrib *attribs;
} plane; } plane;
struct plane *planes; struct plane *planes;
@ -64,4 +64,9 @@ 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(struct plane *pl, struct faction * f, int rel, unsigned char index); extern int rel_to_abs(struct plane *pl, struct faction * f, int rel, unsigned char index);
extern void * resolve_plane(void * data);
extern void write_plane_reference(const plane * p, FILE * F);
extern void read_plane_reference(plane ** pp, FILE * F);
#endif #endif

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: korrektur.c,v 1.24 2001/02/13 18:43:54 katze Exp $ * $Id: korrektur.c,v 1.25 2001/02/17 14:47:43 enno Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -1945,6 +1945,17 @@ fix_baumringel(void)
#include <modules/gmcmd.h> #include <modules/gmcmd.h>
void setup_gm_faction(void); void setup_gm_faction(void);
#include <attributes/gm.h>
static void
set_atgm(faction * f)
{
plane * p = planes;
if (!f) return;
while (p) {
a_add(&f->attribs, make_gm(p));
}
}
void void
korrektur(void) korrektur(void)
{ {
@ -1952,6 +1963,7 @@ korrektur(void)
setup_gm_faction(); setup_gm_faction();
#endif #endif
make_gms(); make_gms();
do_once(atoi36("rrgm"), set_atgm(findfaction(atoi36("rr"))));
/* Wieder entfernen! */ /* Wieder entfernen! */
do_once(atoi36("trgr"), fix_targetregion_resolve()); do_once(atoi36("trgr"), fix_targetregion_resolve());
verify_owners(false); verify_owners(false);