From 05aba860f02c9be35d86f1714b8fb616bcba406a Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 4 Jun 2011 11:20:04 -0700 Subject: [PATCH] http://bugs.eressea.de/view.php?id=1855 fixing delayed-action potions. --- scripts/tests/e3a.lua | 30 ++++++++++++++++++++++++++++++ src/bindings.c | 1 + 2 files changed, 31 insertions(+) diff --git a/scripts/tests/e3a.lua b/scripts/tests/e3a.lua index 34aeb4a0c..6bb16ffce 100644 --- a/scripts/tests/e3a.lua +++ b/scripts/tests/e3a.lua @@ -662,3 +662,33 @@ function test_cannot_walk_into_ocean() assert_equal(1, u.region.x) end +function test_p2() + local f = faction.create("noreply@eressea.de", "human", "de") + local r = region.create(0, 0, "plain") + local u = unit.create(f, r, 1) + r:set_resource("tree", 0) + u:clear_orders() + u:add_order("BENUTZE 'Wasser des Lebens'") + u:add_item("p2", 1) + u:add_item("log", 20) + process_orders() + assert_equal(5, r:get_resource("tree")) +end + +function test_p2_move() + -- http://bugs.eressea.de/view.php?id=1855 + local f = faction.create("noreply@eressea.de", "human", "de") + local r = region.create(0, 0, "plain") + region.create(1, 0, "plain") + local u = unit.create(f, r, 1) + r:set_resource("tree", 0) + u:clear_orders() + u:add_order("BENUTZE 'Wasser des Lebens'") + u:add_order("NACH OST") + u:add_item("horse", 1) + u:add_item("p2", 1) + u:add_item("log", 1) + process_orders() + assert_equal(1, u.region.x) + assert_equal(1, r:get_resource("tree")) +end diff --git a/src/bindings.c b/src/bindings.c index 6cc85592f..7b985b07f 100644 --- a/src/bindings.c +++ b/src/bindings.c @@ -60,6 +60,7 @@ static int fix_familiars(struct lua_State *L) char buffer[64]; ql_free(mage->spells); + mage->spells = 0; snprintf(buffer, sizeof(buffer), "%s_familiar", u->race->_name[0]); eq = get_equipment(buffer);