From bd716035616792d36bc40387f0cf8edb9f048b1f Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 13 Jun 2009 08:40:19 +0000 Subject: [PATCH] WORK command produces minimum wage. --- src/common/kernel/eressea.c | 11 ++++ src/common/kernel/xmlreader.c | 2 +- src/res/e2k9.xml | 3 + src/res/e2k9/races.xml | 68 +++++------------------ src/res/e2k9/strings.xml | 8 +++ src/scripts/e2k9.lua | 8 +-- src/scripts/e2k9/{items.lua => rules.lua} | 0 src/scripts/tests.lua | 16 ++++++ 8 files changed, 56 insertions(+), 60 deletions(-) rename src/scripts/e2k9/{items.lua => rules.lua} (100%) diff --git a/src/common/kernel/eressea.c b/src/common/kernel/eressea.c index c64ae881e..3eb840e88 100644 --- a/src/common/kernel/eressea.c +++ b/src/common/kernel/eressea.c @@ -2689,6 +2689,15 @@ default_wage(const region *r, const faction * f, const race * rc) return wage; } +static int +minimum_wage(const region *r, const faction * f, const race * rc) +{ + if (f && rc) { + return rc->maintenance; + } + return default_wage(r, f, rc); +} + /* Gibt Arbeitslohn für entsprechende Rasse zurück, oder für * die Bauern wenn f == NULL. */ int @@ -2973,6 +2982,8 @@ attrib_init(void) register_bordertype(&bt_road); register_bordertype(&bt_questportal); + register_function((pf_generic)&minimum_wage, "minimum_wage"); + at_register(&at_germs); #if XECMD_MODULE at_register(&at_xontormiaexpress); /* required for old datafiles */ diff --git a/src/common/kernel/xmlreader.c b/src/common/kernel/xmlreader.c index cb3cc956b..866d29e5f 100644 --- a/src/common/kernel/xmlreader.c +++ b/src/common/kernel/xmlreader.c @@ -183,7 +183,7 @@ xml_readconstruction(xmlXPathContextPtr xpath, xmlNodeSetPtr nodeSet, constructi if (propValue!=NULL) { sk = sk_find((const char*)propValue); if (sk==NOSKILL) { - log_error(("construction requires skill '%s' that does not exist.", (const char *)propValue)); + log_error(("construction requires skill '%s' that does not exist.\n", (const char *)propValue)); xmlFree(propValue); continue; } diff --git a/src/res/e2k9.xml b/src/res/e2k9.xml index 5fa286dcd..f28d49736 100644 --- a/src/res/e2k9.xml +++ b/src/res/e2k9.xml @@ -149,6 +149,9 @@ + + + diff --git a/src/res/e2k9/races.xml b/src/res/e2k9/races.xml index 2800c524a..bf66ad820 100644 --- a/src/res/e2k9/races.xml +++ b/src/res/e2k9/races.xml @@ -13,7 +13,6 @@ - @@ -38,7 +37,6 @@ - @@ -61,7 +59,6 @@ - @@ -84,7 +81,6 @@ - @@ -107,7 +103,6 @@ - @@ -132,7 +127,6 @@ - @@ -154,7 +148,6 @@ - @@ -178,7 +171,6 @@ - @@ -744,6 +736,7 @@ + @@ -751,19 +744,14 @@ - - - - - - - + + @@ -775,7 +763,9 @@ - + + @@ -787,6 +777,7 @@ + @@ -799,12 +790,14 @@ + + @@ -838,30 +831,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - + @@ -880,6 +850,7 @@ + @@ -982,20 +953,7 @@ - - - - - - - - - - - - - - + @@ -1003,6 +961,7 @@ + @@ -1013,6 +972,7 @@ + diff --git a/src/res/e2k9/strings.xml b/src/res/e2k9/strings.xml index 52b5ada7b..1e3a2d3df 100644 --- a/src/res/e2k9/strings.xml +++ b/src/res/e2k9/strings.xml @@ -46,6 +46,14 @@ Streitrösser chargers + + Turmschild + tower shield + + + Turmschilde + tower shields + Siebenmeilentee diff --git a/src/scripts/e2k9.lua b/src/scripts/e2k9.lua index 788bc86c4..52aba1b12 100644 --- a/src/scripts/e2k9.lua +++ b/src/scripts/e2k9.lua @@ -30,7 +30,7 @@ function load_scripts() scripts = { "spells.lua", "extensions.lua", - "e2k9/items.lua" + "e2k9/rules.lua" } for index, value in pairs(scripts) do loadscript(value) @@ -70,19 +70,17 @@ function process(orders) -- create new monsters: spawn_dragons() spawn_undead() - spawn_braineaters(0.25) + -- spawn_braineaters(0.25) spawn_ents() -- post-turn updates: - update_xmas2006() - update_embassies() update_guards() update_scores() change_locales() -- use newfactions file to place out new players - autoseed(basepath .. "/newfactions", false) + -- autoseed(basepath .. "/newfactions", false) write_files(locales) diff --git a/src/scripts/e2k9/items.lua b/src/scripts/e2k9/rules.lua similarity index 100% rename from src/scripts/e2k9/items.lua rename to src/scripts/e2k9/rules.lua diff --git a/src/scripts/tests.lua b/src/scripts/tests.lua index 498985a78..b0baf418a 100644 --- a/src/scripts/tests.lua +++ b/src/scripts/tests.lua @@ -371,6 +371,20 @@ function test_market() assert(len>1) end +function test_work() + free_game() + local r = region.create(0, 0, "plain") + local f = faction.create("enno@eressea.de", "human", "de") + f.id = 42 + local u = unit.create(f, r, 1) + u:add_item("money", u.number * 10) -- humans cost 10 + u:set_skill("herbalism", 5) + u:clear_orders() + u:add_order("ARBEITEN") + process_orders() + assert(u:get_item("money")>=10) +end + function test_herbalism() free_game() local r = region.create(0, 0, "plain") @@ -427,9 +441,11 @@ tests = { ["spells"] = test_spells, ["herbalism"] = test_herbalism, ["storage"] = test_storage, + ["work"] = test_work, ["market"] = test_market } mytests = { + ["work"] = test_work, ["herbalism"] = test_herbalism } fail = 0