From 68730749fbcafb04581af479c7bc4cd96035f581 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Mon, 29 Sep 2014 21:19:07 +0200 Subject: [PATCH] fix astral space special direction, vortex (translation issue). --- res/core/de/strings.xml | 4 ++++ src/direction.c | 5 ++++- src/direction.h | 2 +- src/kernel/config.c | 4 ++-- src/kernel/config.h | 2 +- src/spells.c | 1 - src/vortex.c | 36 ++++++++++++++++-------------------- src/vortex.h | 2 +- src/vortex.test.c | 1 - 9 files changed, 29 insertions(+), 28 deletions(-) diff --git a/res/core/de/strings.xml b/res/core/de/strings.xml index 40dedbf8b..cc252c343 100644 --- a/res/core/de/strings.xml +++ b/res/core/de/strings.xml @@ -4771,6 +4771,10 @@ Strudel, einen Mahlstrom, welcher alle Schiffe, die ihn passieren, schwer beschädigen kann. + + This ritual summons a mighty water elemental from the depths of the ocean. + The elemental creates an enormous maelstrom which damages any passing ships. + diff --git a/src/direction.c b/src/direction.c index c499bbfe1..c74434fb3 100644 --- a/src/direction.c +++ b/src/direction.c @@ -1,6 +1,7 @@ #include #include #include "direction.h" +#include "vortex.h" #include "util/language.h" #include "util/umlaut.h" @@ -14,7 +15,7 @@ void init_direction(const struct locale *lang, direction_t dir, const char *str) addtoken(tokens, str, token); } -void init_directions(const struct locale *lang) { +void init_directions(struct locale *lang) { /* mit dieser routine kann man mehrere namen für eine direction geben, * das ist für die hexes ideal. */ const struct { @@ -39,6 +40,8 @@ void init_directions(const struct locale *lang) { int i; void **tokens = get_translations(lang, UT_DIRECTIONS); + register_special_direction(lang, "vortex"); + for (i = 0; dirs[i].direction != NODIRECTION; ++i) { const char *str = locale_string(lang, dirs[i].name); if (str) { diff --git a/src/direction.h b/src/direction.h index e02b5f9f7..aa32046a0 100644 --- a/src/direction.h +++ b/src/direction.h @@ -22,7 +22,7 @@ typedef enum { } direction_t; direction_t get_direction(const char *s, const struct locale *); -void init_directions(const struct locale *lang); +void init_directions(struct locale *lang); void init_direction(const struct locale *lang, direction_t dir, const char *str); direction_t finddirection(const char *str); diff --git a/src/kernel/config.c b/src/kernel/config.c index b368108b5..02f0a0dde 100644 --- a/src/kernel/config.c +++ b/src/kernel/config.c @@ -1779,7 +1779,7 @@ void init_options_translation(const struct locale * lang) { } } -void init_locale(const struct locale *lang) +void init_locale(struct locale *lang) { variant var; int i; @@ -1982,7 +1982,7 @@ void init_locales(void) { int l; for (l = 0; localenames[l]; ++l) { - const struct locale *lang = get_or_create_locale(localenames[l]); + struct locale *lang = get_or_create_locale(localenames[l]); init_locale(lang); } } diff --git a/src/kernel/config.h b/src/kernel/config.h index 9b0f7135b..06474dd65 100644 --- a/src/kernel/config.h +++ b/src/kernel/config.h @@ -177,7 +177,7 @@ extern "C" { int distribute(int old, int new_value, int n); void init_locales(void); - void init_locale(const struct locale *lang); + void init_locale(struct locale *lang); int newunitid(void); int forbiddenid(int id); diff --git a/src/spells.c b/src/spells.c index ba7c9c578..41b6e313c 100644 --- a/src/spells.c +++ b/src/spells.c @@ -6868,7 +6868,6 @@ void register_spells(void) register_function((pf_generic)sp_kampfzauber, "combat_spell"); register_spelldata(); - register_special_direction("vortex"); register_unitcurse(); register_regioncurse(); diff --git a/src/vortex.c b/src/vortex.c index a4517f7bb..a0791907d 100644 --- a/src/vortex.c +++ b/src/vortex.c @@ -26,33 +26,29 @@ typedef struct dir_lookup { static dir_lookup *dir_name_lookup; -void register_special_direction(const char *name) +void register_special_direction(struct locale *lang, const char *name) { - struct locale *lang; - char *str = _strdup(name); + const char *token = LOC(lang, name); - for (lang = locales; lang; lang = nextlocale(lang)) { + if (token) { void **tokens = get_translations(lang, UT_SPECDIR); - const char *token = LOC(lang, name); + variant var; + char *str = _strdup(name); - if (token) { - variant var; + var.v = str; + addtoken(tokens, token, var); - var.v = str; - addtoken(tokens, token, var); - - if (lang == locales) { - dir_lookup *dl = malloc(sizeof(dir_lookup)); - dl->name = str; - dl->oldname = token; - dl->next = dir_name_lookup; - dir_name_lookup = dl; - } - } - else { - log_error("no translation for spec_direction '%s' in locale '%s'\n", name, locale_name(lang)); + if (lang == locales) { + dir_lookup *dl = malloc(sizeof(dir_lookup)); + dl->name = str; + dl->oldname = token; + dl->next = dir_name_lookup; + dir_name_lookup = dl; } } + else { + log_error("no translation for spec_direction '%s' in locale '%s'\n", name, locale_name(lang)); + } } /********************/ diff --git a/src/vortex.h b/src/vortex.h index 905e1d8d5..6202e61d0 100644 --- a/src/vortex.h +++ b/src/vortex.h @@ -19,7 +19,7 @@ extern "C" { struct region *find_special_direction(const struct region *r, const char *token); - void register_special_direction(const char *name); + void register_special_direction(struct locale *lang, const char *name); struct spec_direction *special_direction(const struct region * from, const struct region * to); struct attrib *create_special_direction(struct region *r, struct region *rt, diff --git a/src/vortex.test.c b/src/vortex.test.c index 7185dc82d..152def397 100644 --- a/src/vortex.test.c +++ b/src/vortex.test.c @@ -25,7 +25,6 @@ static void test_move_to_vortex(CuTest *tc) { lang = get_or_create_locale("en"); locale_setstring(lang, "vortex", "wirbel"); init_locale(lang); - register_special_direction("vortex"); t_plain = test_create_terrain("plain", LAND_REGION | FOREST_REGION | WALK_INTO | CAVALRY_REGION); r1 = test_create_region(0, 0, t_plain); r2 = test_create_region(5, 0, t_plain);