keyword lookup macro

This commit is contained in:
Enno Rehling 2014-06-16 23:05:39 -07:00
parent 5c78a3883e
commit 0675c50c7f
8 changed files with 8 additions and 10 deletions

View File

@ -53,8 +53,6 @@
<game name="Eressea">
<!-- Game specific settings -->
<order name="BEZAHLEN" disable="yes"/>
<skill name="alchemy" enable="true"/>
<skill name="crossbow" enable="true"/>
<skill name="mining" enable="true"/>

View File

@ -413,8 +413,7 @@ const char *options[MAXOPTIONS] = {
"ADRESSEN",
"BZIP2",
"PUNKTE",
"SHOWSKCHANGE",
"XML"
"SHOWSKCHANGE"
};
static int allied_skillcount(const faction * f, skill_t sk)

View File

@ -2399,7 +2399,7 @@ static int hunt(unit * u, order * ord)
}
bufp = command;
bytes = slprintf(bufp, size, "%s %s", LOC(u->faction->locale, keywords[K_MOVE]), LOC(u->faction->locale, directions[dir]));
bytes = slprintf(bufp, size, "%s %s", LOC(u->faction->locale, keyword(K_MOVE)), LOC(u->faction->locale, directions[dir]));
if (wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER();

View File

@ -105,7 +105,7 @@ static char* get_command(const order *ord, char *sbuffer, size_t size) {
if (kwd != NOKEYWORD) {
const struct locale *lang = ORD_LOCALE(ord);
if (size > 0) {
const char *str = (const char *)LOC(lang, mkname("keyword", keywords[kwd]));
const char *str = (const char *)LOC(lang, keyword(kwd));
assert(str);
if (text) --size;
bytes = (int)strlcpy(bufp, str, size);

View File

@ -183,7 +183,6 @@ enum {
O_BZIP2, /* 1024 - compress as bzip2 */
O_SCORE, /* 2048 - punkte anzeigen? */
O_SHOWSKCHANGE, /* 4096 - Skillveränderungen anzeigen? */
O_XML, /* 8192 - XML report versenden */
MAXOPTIONS
};

View File

@ -80,6 +80,8 @@ void init_keywords(const struct locale *lang);
void init_keyword(const struct locale *lang, keyword_t kwd, const char *str);
bool keyword_disabled(keyword_t kwd);
void enable_keyword(keyword_t kwd, bool enabled);
#define keyword(kwd) mkname("keyword", keywords[kwd])
#ifdef __cplusplus
#endif
#endif

View File

@ -445,7 +445,7 @@ static order *make_movement_order(unit * u, const region * target, int moves,
bytes =
(int)strlcpy(bufp,
(const char *)LOC(u->faction->locale, keywords[K_MOVE]), size);
(const char *)LOC(u->faction->locale, keyword(K_MOVE)), size);
if (wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER();

View File

@ -336,9 +336,9 @@ static void nr_spell(FILE * F, spellbook_entry * sbe, const struct locale *lang)
size = sizeof(buf) - 1;
if (sp->sptyp & ISCOMBATSPELL) {
bytes = (int)strlcpy(bufp, LOC(lang, keywords[K_COMBATSPELL]), size);
bytes = (int)strlcpy(bufp, LOC(lang, keyword(K_COMBATSPELL)), size);
} else {
bytes = (int)strlcpy(bufp, LOC(lang, keywords[K_CAST]), size);
bytes = (int)strlcpy(bufp, LOC(lang, keyword(K_CAST)), size);
}
if (wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER();