fix xmlreader bug introduced by last commit (xpath->node not initialized)

This commit is contained in:
Enno Rehling 2015-09-11 09:10:00 +02:00
parent 1a7d6dd91d
commit 9bb2a625f9
3 changed files with 19 additions and 3 deletions

View File

@ -146,6 +146,21 @@ function test_no_stealth()
assert_equal(-1, u:get_skill("stealth")) assert_equal(-1, u:get_skill("stealth"))
end end
function test_no_teach()
local r = region.create(0,0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
local u1 = unit.create(f, r, 1)
local u2 = unit.create(f, r, 1)
u1:clear_orders()
u2:clear_orders()
u1:set_skill("riding", 3)
u2:add_order("LERNE Reiten")
u1:add_order("LEHRE " .. itoa36(u2.id))
process_orders()
-- TODO: assert something (reflecting skills sucks!)
end
function test_seecast() function test_seecast()
local r = region.create(0,0, "plain") local r = region.create(0,0, "plain")
for i = 1,10 do for i = 1,10 do

View File

@ -2231,6 +2231,7 @@ static int parse_main(xmlDocPtr doc)
xmlXPathFreeObject(result); xmlXPathFreeObject(result);
xpath->node = node;
/* reading eressea/game/order */ /* reading eressea/game/order */
result = xmlXPathEvalExpression(BAD_CAST "order", xpath); result = xmlXPathEvalExpression(BAD_CAST "order", xpath);
nodes = result->nodesetval; nodes = result->nodesetval;

View File

@ -270,10 +270,10 @@ void init_translations(const struct locale *lang, int ut, const char * (*string_
for (i = 0; i != maxstrings; ++i) { for (i = 0; i != maxstrings; ++i) {
// TODO: swap the name of s and key // TODO: swap the name of s and key
const char * s = string_cb(i); const char * s = string_cb(i);
const char * key = s ? locale_string(lang, s, false) : 0; if (s) {
key = key ? key : s;
if (key) {
struct critbit_tree ** cb = (struct critbit_tree **)tokens; struct critbit_tree ** cb = (struct critbit_tree **)tokens;
const char * key = locale_string(lang, s, false);
if (!key) key = s;
add_translation(cb, key, i); add_translation(cb, key, i);
} }
} }