forked from github/server
fix missing locales initialization
This commit is contained in:
parent
a9f0538d8e
commit
acbef7a3a0
|
@ -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) {
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -14,10 +14,10 @@ without prior permission by the authors of Eressea.
|
|||
#include <kernel/config.h>
|
||||
#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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue