diff --git a/src/common/gamecode/xmas.c b/src/common/gamecode/xmas.c new file mode 100644 index 000000000..6ed724090 --- /dev/null +++ b/src/common/gamecode/xmas.c @@ -0,0 +1,75 @@ +/* vi: set ts=2: + +-------------------+ Christian Schlittchen + | | Enno Rehling + | Eressea PBEM host | Katja Zedel + | (c) 1998 - 2001 | Henning Peters + | | Ingo Wilken + +-------------------+ Stefan Reich + + This program may not be used, modified or distributed + without prior permission by the authors of Eressea. +*/ + +#include +#include +#include "xmas.h" + +/* kernel includes */ +#include +#include +#include +#include +#include + +/* util includes */ +#include + +void +santa_comes_to_town(region * r, unit * santa, void (*action)(unit*)) +{ + faction * f; + + fset(santa, FL_TRAVELTHRU); + for (f = factions;f;f=f->next) { + unit * u; + unit * senior = f->units; + if (!playerrace(f->race)) continue; + for (u = f->units; u; u=u->nextF) { + if (senior->age < u->age || effstealth(senior) > effstealth(u)) senior = u; + } + if (!senior) continue; + + sprintf(buf, "von %s: 'Ho ho ho. Frohe Weihnachten, und alles Gute für dein Volk, %s.'", unitname(santa), unitname(senior)); + addmessage(senior->region, 0, buf, MSG_MESSAGE, ML_IMPORTANT); + + travelthru(santa, senior->region); + if (action) action(senior); + } +} + +unit * +make_santa(region * r) +{ + unit * santa = ufindhash(atoi36("xmas")); + + while (santa && santa->race!=new_race[RC_ILLUSION]) { + uunhash(santa); + santa->no = newunitid(); + uhash(santa); + santa = ufindhash(atoi36("xmas")); + } + if (!santa) { + faction * f = findfaction(atoi36("rr")); + if (f==NULL) return NULL; + f->alive = true; + santa = createunit(r, f, 1, new_race[RC_ILLUSION]); + uunhash(santa); + santa->no = atoi36("xmas"); + uhash(santa); + fset(santa, FL_PARTEITARNUNG); + santa->irace = new_race[RC_GNOME]; + set_string(&santa->name, "Ein dicker Gnom mit einem Rentierschlitten"); + set_string(&santa->display, "hat: 12 Rentiere, Schlitten, Sack mit Geschenken, Kekse für Khorne"); + } + return santa; +} diff --git a/src/common/gamecode/xmas.h b/src/common/gamecode/xmas.h new file mode 100644 index 000000000..1be0170ad --- /dev/null +++ b/src/common/gamecode/xmas.h @@ -0,0 +1,17 @@ +/* vi: set ts=2: + +-------------------+ Christian Schlittchen + | | Enno Rehling + | Eressea PBEM host | Katja Zedel + | (c) 1998 - 2001 | Henning Peters + | | Ingo Wilken + +-------------------+ Stefan Reich + + This program may not be used, modified or distributed + without prior permission by the authors of Eressea. +*/ + +struct region; +struct unit; + +extern void santa_comes_to_town(struct region * r, struct unit * santa, void (*action)(struct unit*)); +extern struct unit * make_santa(struct region * r); diff --git a/src/common/modules/xmas2001.c b/src/common/modules/xmas2001.c new file mode 100644 index 000000000..0c87f258b --- /dev/null +++ b/src/common/modules/xmas2001.c @@ -0,0 +1,50 @@ +/* vi: set ts=2: + +-------------------+ Christian Schlittchen + | | Enno Rehling + | Eressea PBEM host | Katja Zedel + | (c) 1998 - 2001 | Henning Peters + | | Ingo Wilken + +-------------------+ Stefan Reich + + This program may not be used, modified or distributed + without prior permission by the authors of Eressea. +*/ + +#include +#include +#include "xmas2001.h" + +/* kernel includes */ +#include +#include +#include + +/* gamecode includes */ +#include + +/* util includes */ +#include +#include +#include + +#include + +static void +presents(unit * senior) +{ + /* Ein Mistelzweig für alle Anführer */ + static const item_type * itype = NULL; + if (itype==NULL) itype = it_find("mistletoe"); + assert(itype!=NULL); + i_change(&senior->items, itype, 1); +} + +int +xmas2001(void) +{ + region * r = findregion(0, 0); + unit * santa = make_santa(r); + + santa_comes_to_town(r, santa, presents); + return 0; +} diff --git a/src/common/modules/xmas2001.h b/src/common/modules/xmas2001.h new file mode 100644 index 000000000..63a2b07e5 --- /dev/null +++ b/src/common/modules/xmas2001.h @@ -0,0 +1,18 @@ +/* vi: set ts=2: + +-------------------+ Christian Schlittchen + | | Enno Rehling + | Eressea PBEM host | Katja Zedel + | (c) 1998 - 2001 | Henning Peters + | | Ingo Wilken + +-------------------+ Stefan Reich + + This program may not be used, modified or distributed + without prior permission by the authors of Eressea. +*/ + +#ifndef XMAS2001_H +#define XMAS2001_H + +extern int xmas2001(void); + +#endif