diff --git a/src/common/gamecode/economy.c b/src/common/gamecode/economy.c index 9c4a56278..2990a8340 100644 --- a/src/common/gamecode/economy.c +++ b/src/common/gamecode/economy.c @@ -516,7 +516,7 @@ give_peasants(int n, const item_type * itype, unit * src) } } - void +void give_item(int want, const item_type * itype, unit * src, unit * dest, const char * cmd) { short error = 0; @@ -791,7 +791,7 @@ giveunit(region * r, unit * u, unit * u2, strlist * S) } } - static void +static void dogive(region * r, unit * u, strlist * S, boolean liefere, int mode) /* * mode=0: give to any units diff --git a/src/common/gamecode/laws.c b/src/common/gamecode/laws.c index 4878514eb..684ab28e0 100644 --- a/src/common/gamecode/laws.c +++ b/src/common/gamecode/laws.c @@ -73,6 +73,8 @@ #include #include +#include + #ifdef AT_OPTION /* attributes includes */ #include @@ -3533,8 +3535,11 @@ processorders (void) puts(" - Monster fressen und vertreiben Bauern"); monsters_kill_peasants(); - puts(" - Zufallsereignisse"); + puts(" - random events"); randomevents(); + + puts(" - newspaper commands"); + xecmd(); puts(" - regeneration (healing & aura)"); monthly_healing(); diff --git a/src/common/kernel/eressea.c b/src/common/kernel/eressea.c index f04b6359b..ef2ab6a8e 100644 --- a/src/common/kernel/eressea.c +++ b/src/common/kernel/eressea.c @@ -155,7 +155,10 @@ const char *parameters[MAXPARAMS] = "TRÄNKE", "GRUPPE", "PARTEITARNUNG", - "BÄUME" + "BÄUME", + "XEPOTION", + "XEBALLOON", + "XELAEN" }; @@ -232,7 +235,8 @@ const char *keywords[MAXKEYWORDS] = "PRÄFIX", "SYNONYM", "PFLANZEN", - "WERWESEN" + "WERWESEN", + "XONTORMIA" }; const char *report_options[MAX_MSG] = diff --git a/src/common/kernel/eressea.h b/src/common/kernel/eressea.h index 457605774..6a30eb768 100644 --- a/src/common/kernel/eressea.h +++ b/src/common/kernel/eressea.h @@ -438,6 +438,7 @@ enum { K_SYNONYM, K_PFLANZE, K_WEREWOLF, + K_XE, MAXKEYWORDS, NOKEYWORD = (keyword_t) - 1 }; @@ -504,6 +505,9 @@ enum { P_GROUP, P_FACTIONSTEALTH, P_TREES, + P_XEPOTION, + P_XEBALLOON, + P_XELAEN, MAXPARAMS, NOPARAM = (param_t) - 1 }; diff --git a/src/common/modules/xecmd.c b/src/common/modules/xecmd.c new file mode 100644 index 000000000..2b6039f48 --- /dev/null +++ b/src/common/modules/xecmd.c @@ -0,0 +1,115 @@ +/* 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 +#include +#include +#include + +#include "xecmd.h" + +/* kernel includes */ +#include +#include +#include +#include + +#include + +#include + +attrib_type at_xontormiaexpress = { + "xontormiaexpress", + DEFAULT_INIT, + DEFAULT_FINALIZE, + DEFAULT_AGE, + DEFAULT_WRITE, + DEFAULT_READ, + ATF_UNIQUE +}; + +static void +xe_givelaen(unit *u, char *cmd) +{ + unit *u2 =getunitg(u->region, u->faction); + + if(!u2) { + cmistake(u, strdup(cmd), 63, MSG_EVENT); + return; + } + i_change(&u2->items, olditemtype[I_LAEN], 5); +} + +static void +xe_givepotion(unit *u, char *cmd) +{ + unit *u2 =getunitg(u->region, u->faction); + + if(!u2) { + cmistake(u, strdup(cmd), 63, MSG_EVENT); + return; + } + i_change(&u2->items, &it_skillpotion, 1); +} + +static void +xe_giveballon(unit *u, char *cmd) +{ + unit *u2 =getunitg(u->region, u->faction); + ship *sh; + + if(!u2) { + cmistake(u, strdup(cmd), 63, MSG_EVENT); + return; + } + + sh = new_ship(st_find("balloon"),u2->region); + sh->size = 5; + set_string(&sh->name,"Xontormia-Ballon"); + addlist(&u2->region->ships, sh); + leave(u2->region, u2); + u2->ship = sh; + fset(u2, FL_OWNER); +} + +void +xecmd(void) +{ + faction *f; + + for(f=factions; f; f=f->next) { + if(a_find(f->attribs, &at_xontormiaexpress)) { + unit *u; + for(u=f->units; u; u=u->nextF) { + strlist *S; + for(S=u->orders; S; S=S->next) { + if(findkeyword(igetstrtoken(S->s),f->locale) == K_XE) { + switch(findparam(getstrtoken(),f->locale)) { + case P_XEPOTION: + xe_givepotion(u, S->s); + break; + case P_XEBALLOON: + xe_giveballon(u, S->s); + break; + case P_XELAEN: + xe_givelaen(u, S->s); + break; + } + } + } + } + } + } +} + diff --git a/src/common/modules/xecmd.h b/src/common/modules/xecmd.h new file mode 100644 index 000000000..81497a3a9 --- /dev/null +++ b/src/common/modules/xecmd.h @@ -0,0 +1,20 @@ +/* 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 XECMD_H +#define XECMD_H + +extern attrib_type at_xontormiaexpress; +void xecmd(void); + +#endif + diff --git a/src/eressea/korrektur.c b/src/eressea/korrektur.c index 4b9d2165b..140586ec8 100644 --- a/src/eressea/korrektur.c +++ b/src/eressea/korrektur.c @@ -26,6 +26,7 @@ #include #include #include +#include #include /* gamecode includes */ @@ -2746,6 +2747,18 @@ questportal_init(void) return 0; } +static int +xe_init(void) +{ + faction *f = findfaction(atoi36("a5q")); + + if(f) { + a_add(&f->attribs, a_new(&at_xontormiaexpress)); + } + + return 0; +} + void korrektur(void) { @@ -2797,6 +2810,7 @@ korrektur(void) do_once("witm", warn_items()); do_once("guac", guard_conversion()); do_once("qpoi", questportal_init()); + do_once("xini", xe_init()); warn_password(); /* seems something fishy is going on, do this just diff --git a/src/mapper/map_units.c b/src/mapper/map_units.c index 065266b34..4ed6e8cf6 100644 --- a/src/mapper/map_units.c +++ b/src/mapper/map_units.c @@ -1383,8 +1383,19 @@ showunits(region * r) } else { s = strchr(pointer->s, '('); if (s) { + char idbuf[12]; + int i = 0; + s++; - f = atoi36(s); + while(*s != ')') { + idbuf[i] = *s; + i++; s++; + assert(i<=11); + } + idbuf[i] = '\0'; + + f = atoi36(idbuf); + x = findunit(f, r); if (x && modify_unit(r, findunit(f, r))) { for (pline = 0, tmp = eh; tmp != pointer; tmp = tmp->next) diff --git a/src/res/de/strings.xml b/src/res/de/strings.xml index 744c45772..fd16a4a38 100644 --- a/src/res/de/strings.xml +++ b/src/res/de/strings.xml @@ -1551,6 +1551,16 @@ ZAUBER + + + XETRANK + + + XEBALLON + + + XELAEN + Talente: