From b70fc769215e4c6c63d9c70b09d6a5987efd8943 Mon Sep 17 00:00:00 2001 From: TomBraun Date: Wed, 2 Jul 2014 13:58:10 +0200 Subject: [PATCH] Fix BUG 0001976 http://bugs.eressea.de/view.php?id=1976 Check that only buling owner set k_pay disable If other unit inside the building set k_pay disable it have now no effect, before only fraction was check --- scripts/tests/eressea.lua | 22 ++++++++++++++++++++++ src/laws.c | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/scripts/tests/eressea.lua b/scripts/tests/eressea.lua index e2825d973..92dd8ac3f 100644 --- a/scripts/tests/eressea.lua +++ b/scripts/tests/eressea.lua @@ -335,3 +335,25 @@ function test_stonegolems() -- end test Stone Golems four stones end +function test_only_building_ownwer_can_set_not_paid() + 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) + local mine = building.create(r, "mine") + mine.size = 2 + u1:add_item("money", 500) + u1.building = mine + u2.building = mine + u1:clear_orders() + u2:clear_orders() + u2:add_order("Bezahle nicht") + process_orders() + assert_equal(0, u1:get_item("money")) + u2:clear_orders() + u1:add_item("money", 500) + u1:add_order("Bezahle nicht") + process_orders() + assert_equal(500, u1:get_item("money")) +end + diff --git a/src/laws.c b/src/laws.c index 89dc41e08..0779e8ccd 100755 --- a/src/laws.c +++ b/src/laws.c @@ -4027,7 +4027,7 @@ int pay_cmd(unit * u, struct order *ord) p = getparam(u->faction->locale); if (p == P_NOT) { unit *owner = building_owner(u->building); - if (owner->faction != u->faction) { + if (owner->no != u->no) { cmistake(u, ord, 1222, MSG_EVENT); } else { u->building->flags |= BLD_DONTPAY;