remove the XONTORMIA & WEREWOLF commands.

This commit is contained in:
Enno Rehling 2012-06-17 11:08:48 -07:00
parent 1b24f14da0
commit f11005c686
12 changed files with 50 additions and 196 deletions

View File

@ -160,7 +160,6 @@ set (LIB_SRC
modules/score.c modules/score.c
modules/weather.c modules/weather.c
modules/wormhole.c modules/wormhole.c
modules/xecmd.c
modules/xmas.c modules/xmas.c
triggers/changefaction.c triggers/changefaction.c
triggers/changerace.c triggers/changerace.c

View File

@ -88,7 +88,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <util/rng.h> #include <util/rng.h>
#include <util/xml.h> #include <util/xml.h>
#include <modules/xecmd.h>
#include <attributes/otherfaction.h> #include <attributes/otherfaction.h>
/* libc includes */ /* libc includes */
@ -3639,8 +3638,6 @@ void check_long_orders(unit * u)
cmistake(u, ord, 52, MSG_EVENT); cmistake(u, ord, 52, MSG_EVENT);
} }
break; break;
case K_WEREWOLF:
/* don't know what WEREWOLF does... */
default: default:
cmistake(u, ord, 52, MSG_EVENT); cmistake(u, ord, 52, MSG_EVENT);
} }
@ -3696,7 +3693,10 @@ void update_long_order(unit * u)
case K_BUY: case K_BUY:
case K_SELL: case K_SELL:
/* Wenn die Einheit handelt, muß der Default-Befehl gelöscht /* Wenn die Einheit handelt, muß der Default-Befehl gelöscht
* werden. */ * werden.
* Wird je diese Ausschliesslichkeit aufgehoben, muss man aufpassen
* mit der Reihenfolge von Kaufen, Verkaufen etc., damit es Spielern
* nicht moeglich ist, Schulden zu machen. */
trade = true; trade = true;
break; break;
@ -3706,13 +3706,6 @@ void update_long_order(unit * u)
set_order(&u->thisorder, NULL); set_order(&u->thisorder, NULL);
break; break;
case K_WEREWOLF:
set_order(&u->thisorder, copy_order(ord));
break;
/* Wird je diese Ausschliesslichkeit aufgehoben, muss man aufpassen
* mit der Reihenfolge von Kaufen, Verkaufen etc., damit es Spielern
* nicht moeglich ist, Schulden zu machen. */
default: default:
break; break;
} }
@ -4580,10 +4573,6 @@ void init_processor(void)
p += 10; p += 10;
add_proc_order(p, K_GUARD, &guard_on_cmd, 0, "Bewache (an)"); add_proc_order(p, K_GUARD, &guard_on_cmd, 0, "Bewache (an)");
#if XECMD_MODULE
/* can do together with guard */
add_proc_order(p, K_XE, &xecmd, 0, "Zeitung");
#endif
p += 10; p += 10;
add_proc_global(p, &encounters, "Zufallsbegegnungen"); add_proc_global(p, &encounters, "Zufallsbegegnungen");

View File

@ -54,7 +54,7 @@ use_skillpotion(struct unit *u, const struct item_type *itype, int amount,
while (sv != u->skills + u->skill_size) { while (sv != u->skills + u->skill_size) {
int i; int i;
for (i = 0; i != 3; ++i) for (i = 0; i != 3; ++i)
learn_skill(u, sv->id, 1.0); learn_skill(u, (skill_t)sv->id, 1.0);
++sv; ++sv;
} }
} }

View File

@ -99,18 +99,6 @@ boolean sqlpatch = false;
boolean battledebug = false; boolean battledebug = false;
int turn = 0; int turn = 0;
#if XECMD_MODULE
attrib_type at_xontormiaexpress = {
"xontormiaexpress",
DEFAULT_INIT,
DEFAULT_FINALIZE,
DEFAULT_AGE,
a_writeint,
a_readint,
ATF_UNIQUE
};
#endif
int NewbieImmunity(void) int NewbieImmunity(void)
{ {
static int value = -1; static int value = -1;
@ -458,8 +446,6 @@ const char *keywords[MAXKEYWORDS] = {
"INFO", "INFO",
"PRAEFIX", "PRAEFIX",
"PFLANZEN", "PFLANZEN",
"WERWESEN",
"XONTORMIA",
"ALLIANZ", "ALLIANZ",
"BEANSPRUCHEN", "BEANSPRUCHEN",
"PROMOTION", "PROMOTION",
@ -3021,9 +3007,8 @@ void attrib_init(void)
register_function((pf_generic) & minimum_wage, "minimum_wage"); register_function((pf_generic) & minimum_wage, "minimum_wage");
at_register(&at_germs); at_register(&at_germs);
#if XECMD_MODULE
at_register(&at_xontormiaexpress); /* required for old datafiles */ at_deprecate("xontormiaexpress", a_readint); /* required for old datafiles */
#endif
at_register(&at_speedup); at_register(&at_speedup);
at_register(&at_building_action); at_register(&at_building_action);
} }

View File

@ -458,10 +458,6 @@ extern "C" {
# define count_unit(u) 1 # define count_unit(u) 1
#endif #endif
#if XECMD_MODULE
extern struct attrib_type at_xontormiaexpress;
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -447,8 +447,6 @@ int is_exclusive(const order * ord)
switch (kwd) { switch (kwd) {
case K_MOVE: case K_MOVE:
case K_WEREWOLF:
/* these should not become persistent */
case K_ROUTE: case K_ROUTE:
case K_DRIVE: case K_DRIVE:
case K_WORK: case K_WORK:
@ -513,7 +511,6 @@ int is_long(const order * ord)
case K_BUY: case K_BUY:
case K_SELL: case K_SELL:
case K_MOVE: case K_MOVE:
case K_WEREWOLF:
case K_ROUTE: case K_ROUTE:
case K_DRIVE: case K_DRIVE:
case K_WORK: case K_WORK:
@ -573,7 +570,6 @@ int is_persistent(const order * ord)
int persist = ord->_persistent != 0; int persist = ord->_persistent != 0;
switch (kwd) { switch (kwd) {
case K_MOVE: case K_MOVE:
case K_WEREWOLF:
case NOKEYWORD: case NOKEYWORD:
/* lang, aber niemals persistent! */ /* lang, aber niemals persistent! */
return false; return false;

View File

@ -137,8 +137,6 @@ typedef enum {
K_INFO, /* set player-info */ K_INFO, /* set player-info */
K_PREFIX, K_PREFIX,
K_PLANT, K_PLANT,
K_WEREWOLF,
K_XE,
K_ALLIANCE, K_ALLIANCE,
K_CLAIM, K_CLAIM,
K_PROMOTION, K_PROMOTION,

View File

@ -1,108 +0,0 @@
/* vi: set ts=2:
+-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
| | Enno Rehling <enno@eressea.de>
| Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
| (c) 1998 - 2003 | Henning Peters <faroul@beyond.kn-bremen.de>
| | Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
+-------------------+ Stefan Reich <reich@halbling.de>
This program may not be used, modified or distributed
without prior permission by the authors of Eressea.
*/
#include <platform.h>
#include <kernel/config.h>
#if XECMD_MODULE
#include "xecmd.h"
#include <items/xerewards.h>
#include "xecmd.h"
/* kernel includes */
#include <kernel/faction.h>
#include <kernel/item.h>
#include <kernel/message.h>
#include <kernel/order.h>
#include <kernel/region.h>
#include <kernel/save.h>
#include <kernel/ship.h>
#include <kernel/unit.h>
/* util includes */
#include <util/attrib.h>
#include <util/base36.h>
#include <util/parser.h>
/* libc includes */
#include <stdlib.h>
#include <string.h>
#include <assert.h>
static void xe_givelaen(unit * u, struct order *ord)
{
unit *u2 = getunitg(u->region, u->faction);
if (!u2) {
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "feedback_unit_not_found",
""));
return;
}
i_change(&u2->items, olditemtype[I_LAEN], 5);
}
static void xe_givepotion(unit * u, struct order *ord)
{
unit *u2 = getunitg(u->region, u->faction);
if (!u2) {
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "feedback_unit_not_found",
""));
return;
}
i_change(&u2->items, it_find("skillpotion"), 1);
}
static void xe_giveballon(unit * u, struct order *ord)
{
unit *u2 = getunitg(u->region, u->faction);
ship *sh;
if (!u2) {
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "feedback_unit_not_found",
""));
return;
}
sh = new_ship(st_find("balloon"), u2->region, u2->faction->locale);
sh->size = 5;
ship_setname(sh, "Xontormia-Ballon");
leave(u2, true);
u_set_ship(u2, sh);
}
int xecmd(unit * u, order * ord)
{
faction *f = u->faction;
if (a_find(f->attribs, &at_xontormiaexpress)) {
if (get_keyword(ord) == K_XE) {
param_t param;
init_tokens(ord);
skip_token();
param = findparam(getstrtoken(), f->locale);
if (param == P_XEPOTION) {
xe_givepotion(u, ord);
} else if (param == P_XEBALLOON) {
xe_giveballon(u, ord);
} else if (param == P_XELAEN) {
xe_givelaen(u, ord);
}
}
}
return 0;
}
#endif

View File

@ -1,26 +0,0 @@
/* vi: set ts=2:
+-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
| | Enno Rehling <enno@eressea.de>
| Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
| (c) 1998 - 2003 | Henning Peters <faroul@beyond.kn-bremen.de>
| | Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
+-------------------+ Stefan Reich <reich@halbling.de>
This program may not be used, modified or distributed
without prior permission by the authors of Eressea.
*/
#ifndef H_MOD_XECMD_H
#define H_MOD_XECMD_H
#ifdef __cplusplus
extern "C" {
#endif
#if XECMD_MODULE
int xecmd(struct unit *u, struct order *ord);
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@ -44,7 +44,6 @@
#define SCORE_MODULE 1 #define SCORE_MODULE 1
#define MUSEUM_MODULE 1 #define MUSEUM_MODULE 1
#define ARENA_MODULE 1 #define ARENA_MODULE 1
#define XECMD_MODULE 1
#define DUNGEON_MODULE 0 #define DUNGEON_MODULE 0
#define CHANGED_CROSSBOWS 0 /* use the WTF_ARMORPIERCING flag */ #define CHANGED_CROSSBOWS 0 /* use the WTF_ARMORPIERCING flag */
#undef GLOBAL_WARMING /* number of turns before global warming sets in */ #undef GLOBAL_WARMING /* number of turns before global warming sets in */

View File

@ -22,6 +22,8 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "log.h" #include "log.h"
#include "storage.h" #include "storage.h"
#include <critbit.h>
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
@ -261,6 +263,16 @@ int a_age(attrib ** p)
return (*p != NULL); return (*p != NULL);
} }
static critbit_tree cb_deprecated = { 0 };
void at_deprecate(const char * name, int (*reader)(attrib *, void *, struct storage *))
{
char buffer[64];
size_t len = strlen(name);
len = cb_new_kv(name, len, &reader, sizeof(reader), buffer);
cb_insert(&cb_deprecated, buffer, len);
}
int a_read(struct storage *store, attrib ** attribs, void *owner) int a_read(struct storage *store, attrib ** attribs, void *owner)
{ {
int key, retval = AT_READ_OK; int key, retval = AT_READ_OK;
@ -275,25 +287,38 @@ int a_read(struct storage *store, attrib ** attribs, void *owner)
key = __at_hashkey(zText); key = __at_hashkey(zText);
while (key != -1) { while (key != -1) {
int (*reader)(attrib *, void *, struct storage *) = 0;
attrib_type *at = at_find(key); attrib_type *at = at_find(key);
if (!at) { attrib * na = 0;
fprintf(stderr, "attribute hash: %d (%s)\n", key, zText);
assert(at || !"attribute not registered"); if (at) {
reader = at->read;
na = a_new(at);
} else {
const void * kv;
cb_find_prefix(&cb_deprecated, zText, strlen(zText)+1, &kv, 1, 0);
if (kv) {
cb_get_kv(kv, &reader, sizeof(reader));
} else {
fprintf(stderr, "attribute hash: %d (%s)\n", key, zText);
assert(at || !"attribute not registered");
}
} }
if (at->read) { if (reader) {
attrib *na = a_new(at); int i = reader(na, owner, store);
int i = at->read(na, owner, store); if (na) {
switch (i) { switch (i) {
case AT_READ_OK: case AT_READ_OK:
a_add(attribs, na); a_add(attribs, na);
break; break;
case AT_READ_FAIL: case AT_READ_FAIL:
retval = AT_READ_FAIL; retval = AT_READ_FAIL;
a_free(na); a_free(na);
break; break;
default: default:
assert(!"invalid return value"); assert(!"invalid return value");
break; break;
}
} }
} else { } else {
assert(!"fehler: keine laderoutine für attribut"); assert(!"fehler: keine laderoutine für attribut");

View File

@ -61,6 +61,7 @@ extern "C" {
} attrib_type; } attrib_type;
extern void at_register(attrib_type * at); extern void at_register(attrib_type * at);
extern void at_deprecate(const char * name, int (*reader)(attrib *, void *, struct storage *));
extern attrib *a_select(attrib * a, const void *data, extern attrib *a_select(attrib * a, const void *data,
boolean(*compare) (const attrib *, const void *)); boolean(*compare) (const attrib *, const void *));