From 0106d6d2fae68e42824326b0207ae5e70bf97512 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 14 Apr 2001 13:10:52 +0000 Subject: [PATCH] dev-version: update auf letzten live-stand --- src/common/attributes/otherfaction.c | 32 ++++++++++++++ src/common/attributes/otherfaction.h | 16 +++++++ src/common/gamecode/laws.c | 1 + src/mapper/map_partei.c | 62 ---------------------------- 4 files changed, 49 insertions(+), 62 deletions(-) create mode 100644 src/common/attributes/otherfaction.c create mode 100644 src/common/attributes/otherfaction.h diff --git a/src/common/attributes/otherfaction.c b/src/common/attributes/otherfaction.c new file mode 100644 index 000000000..1ce0ed46e --- /dev/null +++ b/src/common/attributes/otherfaction.c @@ -0,0 +1,32 @@ +/* vi: set ts=2: + * + * + * Eressea PB(E)M host Copyright (C) 1998-2000 + * Christian Schlittchen (corwin@amber.kn-bremen.de) + * Katja Zedel (katze@felidae.kn-bremen.de) + * Henning Peters (faroul@beyond.kn-bremen.de) + * Enno Rehling (enno@eressea-pbem.de) + * Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de) + * + * This program may not be used, modified or distributed without + * prior permission by the authors of Eressea. + */ + +#include +#include "otherfaction.h" + +#include + +/* + * simple attributes that do not yet have their own file + */ + +attrib_type at_otherfaction = { + "otherfaction", NULL, NULL, NULL, a_writedefault, a_readdefault, ATF_UNIQUE +}; + +void +init_otherfaction(void) +{ + at_register(&at_otherfaction); +} diff --git a/src/common/attributes/otherfaction.h b/src/common/attributes/otherfaction.h new file mode 100644 index 000000000..e258ee53c --- /dev/null +++ b/src/common/attributes/otherfaction.h @@ -0,0 +1,16 @@ +/* vi: set ts=2: + * + * + * Eressea PB(E)M host Copyright (C) 1998-2000 + * Christian Schlittchen (corwin@amber.kn-bremen.de) + * Katja Zedel (katze@felidae.kn-bremen.de) + * Henning Peters (faroul@beyond.kn-bremen.de) + * Enno Rehling (enno@eressea-pbem.de) + * Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de) + * + * This program may not be used, modified or distributed without + * prior permission by the authors of Eressea. + */ + +extern struct attrib_type at_otherfaction; +extern void init_otherfaction(void); diff --git a/src/common/gamecode/laws.c b/src/common/gamecode/laws.c index 823efb5a2..f63558954 100644 --- a/src/common/gamecode/laws.c +++ b/src/common/gamecode/laws.c @@ -222,6 +222,7 @@ restart(unit *u, int race) { faction *f = addplayer(u->region, u->faction->email, race)->faction; f->magiegebiet = u->faction->magiegebiet; + f->options = u->faction->options; destroyfaction(u->faction); } diff --git a/src/mapper/map_partei.c b/src/mapper/map_partei.c index 5b896401a..133dafb4b 100644 --- a/src/mapper/map_partei.c +++ b/src/mapper/map_partei.c @@ -282,68 +282,6 @@ SeedPartei(void) return goodregion(rc); } -#define MAX_FACTION_ID (36*36*36*36) - -static int -unused_faction_id(void) -{ - int id = rand()%MAX_FACTION_ID; - - while(!faction_id_is_unused(id)) { - id++; if(id == MAX_FACTION_ID) id = 0; - } - - return id; -} - -static unit * -addplayer(region *r, char *email, race_t frace) -{ - int i; - unit *u; - - faction *f = (faction *) calloc(1, sizeof(faction)); - - set_string(&f->email, email); - - for (i = 0; i < 6; i++) buf[i] = (char) (97 + rand() % 26); buf[i] = 0; - set_string(&f->passw, buf); - - f->lastorders = turn; - f->alive = 1; - f->age = 0; - f->race = frace; - f->magiegebiet = 0; - set_ursprung(f, 0, r->x, r->y); - - f->options = Pow(O_REPORT) | Pow(O_STATISTICS) | Pow(O_ZUGVORLAGE) | - Pow(O_SILBERPOOL); - - f->no = unused_faction_id(); - register_faction_id(f->no); - - f->unique_id = max_unique_id + 1; - max_unique_id++; - - sprintf(buf, "Partei %s", factionid(f)); - set_string(&f->name, buf); - fset(f, FL_UNNAMED); - - addlist(&factions, f); - - u = createunit(r, f, 1, f->race); - give_starting_equipment(r, u); - fset(u, FL_ISNEW); - if (f->race == RC_DAEMON) { - do - u->irace = (char) (rand() % MAXRACES); - while (u->irace == RC_DAEMON || race[u->irace].nonplayer); - } - fset(u, FL_PARTEITARNUNG); - - return u; -} - void NeuePartei(region * r) {