diff --git a/src/kernel/config.c b/src/kernel/config.c index d28ba1f81..465f20ef9 100644 --- a/src/kernel/config.c +++ b/src/kernel/config.c @@ -1899,7 +1899,6 @@ static void init_locale(const struct locale *lang) init_translations(lang, UT_PARAMS, parameter_key, MAXPARAMS); init_translations(lang, UT_SKILLS, skill_key, MAXSKILLS); -// init_translations(lang, UT_KEYWORDS, keyword_key, MAXKEYWORDS); tokens = get_translations(lang, UT_OPTIONS); for (i = 0; i != MAXOPTIONS; ++i) { diff --git a/src/kernel/jsonconf.c b/src/kernel/jsonconf.c index d3f9191e4..a487b7c21 100644 --- a/src/kernel/jsonconf.c +++ b/src/kernel/jsonconf.c @@ -203,7 +203,7 @@ void json_terrains(cJSON *json) { return; } for (child=json->child;child;child=child->next) { - json_terrain(child, terrain_get_or_create(child->string)); + json_terrain(child, get_or_create_terrain(child->string)); } } diff --git a/src/kernel/reports.c b/src/kernel/reports.c index 3eac8c046..58d11a0b0 100644 --- a/src/kernel/reports.c +++ b/src/kernel/reports.c @@ -601,7 +601,8 @@ bufunit(const faction * f, const unit * u, int indent, int mode, char *buf, /* status */ if (u->number && (u->faction == f || telepath_see || isbattle)) { - const char *c = locale_string(f->locale, hp_status(u)); + const char *c = hp_status(u); + c = c ? locale_string(f->locale, c) : 0; bytes = (int)strlcpy(bufp, ", ", size); if (wrptr(&bufp, &size, bytes) != 0) WARN_STATIC_BUFFER(); diff --git a/src/kernel/terrain.c b/src/kernel/terrain.c index 38d38a671..4728d7b2b 100644 --- a/src/kernel/terrain.c +++ b/src/kernel/terrain.c @@ -105,7 +105,7 @@ const terrain_type *get_terrain(const char *name) { return terrain_find_i(name); } -terrain_type * terrain_get_or_create(const char *name) { +terrain_type * get_or_create_terrain(const char *name) { terrain_type *terrain = terrain_find_i(name); if (!terrain) { terrain = (terrain_type *)calloc(sizeof(terrain_type), 1); diff --git a/src/kernel/terrain.h b/src/kernel/terrain.h index 69c631e4e..0b6842fa8 100644 --- a/src/kernel/terrain.h +++ b/src/kernel/terrain.h @@ -70,7 +70,7 @@ extern "C" { struct terrain_type *next; } terrain_type; - extern terrain_type *terrain_get_or_create(const char *name); + extern terrain_type *get_or_create_terrain(const char *name); extern const terrain_type *terrains(void); extern const terrain_type *get_terrain(const char *name); extern const char *terrain_name(const struct region *r); diff --git a/src/kernel/xmlreader.c b/src/kernel/xmlreader.c index b2a9ec24c..31226c830 100644 --- a/src/kernel/xmlreader.c +++ b/src/kernel/xmlreader.c @@ -14,10 +14,10 @@ without prior permission by the authors of Eressea. #include #include "xmlreader.h" -/* kernel includes */ #include "building.h" #include "equipment.h" #include "item.h" +#include "keyword.h" #include "messages.h" #include "race.h" #include "region.h" @@ -1950,14 +1950,14 @@ static int parse_terrains(xmlDocPtr doc) nodes = terrains->nodesetval; for (i = 0; i != nodes->nodeNr; ++i) { xmlNodePtr node = nodes->nodeTab[i]; - terrain_type *terrain = calloc(1, sizeof(terrain_type)); + terrain_type *terrain; xmlChar *propValue; xmlXPathObjectPtr xpathChildren; xmlNodeSetPtr children; propValue = xmlGetProp(node, BAD_CAST "name"); assert(propValue != NULL); - terrain->_name = _strdup((const char *)propValue); + terrain = get_or_create_terrain((const char *)propValue); xmlFree(propValue); terrain->max_road = (short)xml_ivalue(node, "road", 0); @@ -2053,7 +2053,6 @@ static int parse_terrains(xmlDocPtr doc) } xmlXPathFreeObject(xpathChildren); - register_terrain(terrain); } xmlXPathFreeObject(terrains); @@ -2226,6 +2225,7 @@ static int parse_strings(xmlDocPtr doc) xmlXPathFreeObject(strings); xmlXPathFreeContext(xpath); + init_locales(); return 0; } diff --git a/src/tests.c b/src/tests.c index 7796d063b..8c27d845b 100644 --- a/src/tests.c +++ b/src/tests.c @@ -73,7 +73,7 @@ void test_cleanup(void) terrain_type * test_create_terrain(const char * name, unsigned int flags) { - terrain_type * t = terrain_get_or_create(name); + terrain_type * t = get_or_create_terrain(name); t->_name = _strdup(name); t->flags = flags; return t;