From ade7b2ef43ceae42890b2b15c6f646cba94aee10 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 10 Jun 2018 09:51:08 +0200 Subject: [PATCH 1/4] BUG 2446: trade prices not getting read from XML. --- scripts/tests/e2/e2features.lua | 23 ++++++++++++++++++++++- src/exparse.c | 4 +++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/scripts/tests/e2/e2features.lua b/scripts/tests/e2/e2features.lua index 4758fce39..be09ec448 100644 --- a/scripts/tests/e2/e2features.lua +++ b/scripts/tests/e2/e2features.lua @@ -491,8 +491,29 @@ function test_dwarf_mining() local f = faction.create('dwarf') local r = region.create(0, 0, 'plain') local u = unit.create(f, r) - u.name = 'Xolgrim' u:set_skill('mining', 2) assert_equal(2, u:get_skill('mining')) assert_equal(4, u:eff_skill('mining')) end + +function test_buy_sell() + local f = faction.create('human') + local r = region.create(0, 0, 'plain') + local u = unit.create(f, r) + local lux = r.luxury + local b = building.create(r, 'castle') + b.size = 10 + u:set_skill('trade', 1) + item = 'silk' + name = 'Seide' + if lux == 'silk' then + item = 'balm' + name = 'Balsam' + end + u:add_item(item, 5) + u:add_order('VERKAUFE 1 ' .. name) + assert_equal(0, u:get_item('money')) + process_orders() + assert_equal(4, u:get_item(item)) + assert_not_equal(0, u:get_item('money')) +end diff --git a/src/exparse.c b/src/exparse.c index e6975fc17..ed6452e40 100644 --- a/src/exparse.c +++ b/src/exparse.c @@ -818,7 +818,9 @@ static void start_resources(parseinfo *pi, const XML_Char *el, const XML_Char ** handle_requirement(pi, el, attr); } else if (xml_strcmp(el, "luxury") == 0) { - rtype->ltype = new_luxurytype(itype, 0); + int price = atoi(attr_get(attr, "price")); + assert(price > 0); + rtype->ltype = new_luxurytype(itype, price); } else if (xml_strcmp(el, "potion") == 0) { int i, level = 0; From 9d693d08e44e5c76bb74c94c0a593674accd4f81 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 10 Jun 2018 10:16:34 +0200 Subject: [PATCH 2/4] BUG 2443, list of roads missing whitespace. --- res/translations/strings.de.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/res/translations/strings.de.po b/res/translations/strings.de.po index e56e36f55..8197e7821 100644 --- a/res/translations/strings.de.po +++ b/res/translations/strings.de.po @@ -1907,7 +1907,7 @@ msgid "castle" msgstr "Burg" msgid "nr_borderlist_infix" -msgstr ", im" +msgstr ", im " msgctxt "race" msgid "shadowbat_p" @@ -3707,7 +3707,7 @@ msgid "analyse_object" msgstr "Lied des Ortes analysieren" msgid "nr_borderlist_lastfix" -msgstr "und im" +msgstr "und im " msgctxt "race" msgid "shadowknight_d" From 8bfa9a77c59a2502ca570745b362c09ed7b35edb Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 10 Jun 2018 10:23:35 +0200 Subject: [PATCH 3/4] BUG 2443: spaces for list of roads, again! --- res/translations/strings.de.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/res/translations/strings.de.po b/res/translations/strings.de.po index 8197e7821..95d973e35 100644 --- a/res/translations/strings.de.po +++ b/res/translations/strings.de.po @@ -5573,7 +5573,7 @@ msgid "swamp_trail" msgstr "der Sumpf von %s" msgid "nr_nb_final" -msgstr "und im" +msgstr " und im " msgid "aoc" msgstr "Katzenamulett" From af898c29a39cb677686d48b3aba12828749bb11e Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 10 Jun 2018 10:23:35 +0200 Subject: [PATCH 4/4] BUG 2443: spaces for list of roads, again! --- res/translations/strings.de.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/res/translations/strings.de.po b/res/translations/strings.de.po index 8197e7821..622f4a536 100644 --- a/res/translations/strings.de.po +++ b/res/translations/strings.de.po @@ -5573,7 +5573,7 @@ msgid "swamp_trail" msgstr "der Sumpf von %s" msgid "nr_nb_final" -msgstr "und im" +msgstr "und im " msgid "aoc" msgstr "Katzenamulett"