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
This commit is contained in:
TomBraun 2014-07-02 13:58:10 +02:00
parent 6e825d5677
commit b70fc76921
2 changed files with 23 additions and 1 deletions

View File

@ -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

View File

@ -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;