dev-version: update auf letzten live-stand

This commit is contained in:
Enno Rehling 2001-04-14 13:10:52 +00:00
parent 7dfb177044
commit 0106d6d2fa
4 changed files with 49 additions and 62 deletions

View File

@ -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 <config.h>
#include "otherfaction.h"
#include <attrib.h>
/*
* 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);
}

View File

@ -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);

View File

@ -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);
}

View File

@ -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)
{