Möglichkeit eingebaut, um Befehle per XML-Datei abzuschalten (ARBEITE z.B.)

This commit is contained in:
Enno Rehling 2001-12-13 21:57:46 +00:00
parent a464c031c3
commit 76ee36212d
5 changed files with 29 additions and 10 deletions

View file

@ -1204,6 +1204,7 @@ findkeyword(const char *s, const struct locale * lang)
if(*s == '@') s++;
#endif
if (findtoken(&lnames->keywords, s, (void**)&i)==E_TOK_NOMATCH) return NOKEYWORD;
if (global.disabled[i]) return NOKEYWORD;
return (keyword_t) i;
}
@ -2095,6 +2096,17 @@ parse_tagbegin(struct xml_stack *stack, void *data)
log_printf("required tag 'file' missing from include");
return XML_USERERROR;
}
} else if (strcmp(tag->name, "order")==0) {
const char * name = xml_value(tag, "name");
if (xml_bvalue(tag, "disable")) {
int k;
for (k=0;k!=MAXKEYWORDS;++k) {
if (strncmp(keywords[k], name, strlen(name))==0) {
global.disabled[k]=0;
break;
}
}
}
} else if (strcmp(tag->name, "races")==0) {
read_races(stack->stream, stack);
} else if (strcmp(tag->name, "strings")==0) {

View file

@ -159,14 +159,6 @@ struct xml_stack;
#define NEWRACE_VERSION 307
#define UGROUPS_VERSION 400 /* nicht aktivieren, nicht fertig */
/* globale settings des Spieles */
typedef struct settings {
const char *gamename;
struct attrib *attribs;
unsigned int data_version;
} settings;
extern settings global;
#define RELEASE_VERSION NEWRACE_VERSION
/*
@ -1175,4 +1167,13 @@ extern const char *locales[];
extern race_t old_race(const struct race *);
extern const struct race * new_race[];
/* globale settings des Spieles */
typedef struct settings {
const char *gamename;
struct attrib *attribs;
unsigned int data_version;
boolean disabled[MAXKEYWORDS];
} settings;
extern settings global;
#endif

View file

@ -73,7 +73,7 @@
#include <attributes/targetregion.h>
#include <attributes/key.h>
#if 0
static int
skillmodifieslearning(void)
{
@ -99,6 +99,7 @@ skillmodifieslearning(void)
}
return 0;
}
#endif
extern void reorder_owners(struct region * r);

View file

@ -10,8 +10,10 @@
<include file="races.xml"></include>
<include file="items.xml"></include>
<game name="eressea">
<game name="Eressea">
<comment>Game specific</comment>
<order name="MEINUNG" disable></order>
<order name="MAGIEGEBIET" disable></order>
<include file="eressea/races.xml"></include>
<include file="eressea/items.xml"></include>
</game>

View file

@ -12,6 +12,9 @@
<game name="Vinyambar">
<comment>Game specific</comment>
<order name="ARBEITEN" disable></order>
<order name="MEINUNG" disable></order>
<order name="MAGIEGEBIET" disable></order>
<include file="vinyambar/races.xml"></include>
</game>
</eressea>