forked from github/server
bugfix: USE snowman did not check that the unit actually owned a snowman, causing a unit to have negative snowmen in turn 629 (exploit).
This commit is contained in:
parent
455b3dc90e
commit
9ac90dd6a5
|
@ -1,12 +1,18 @@
|
||||||
function use_snowman(u, amount)
|
function use_snowman(u, amount)
|
||||||
if u.region.terrain == "glacier" then
|
local have = u:get_item("snowman")
|
||||||
local man = unit.create(u.faction, u.region)
|
if have<amount then
|
||||||
man.race = "snowman"
|
amount = have
|
||||||
man.number = amount
|
end
|
||||||
u:add_item("snowman", -amount)
|
if amount>0 and u.region.terrain == "glacier" then
|
||||||
return 0
|
local man = unit.create(u.faction, u.region)
|
||||||
end
|
man.race = "snowman"
|
||||||
return -4
|
man.number = amount
|
||||||
|
if u:add_item("snowman", -amount)~= nil then
|
||||||
|
return -1
|
||||||
|
end
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
return -4
|
||||||
end
|
end
|
||||||
|
|
||||||
local self = {}
|
local self = {}
|
||||||
|
|
Loading…
Reference in New Issue