Skip to content

Commit

Permalink
fix bug in feeding code
Browse files Browse the repository at this point in the history
wesnoth.current.event_context might not contain all information if the die event was triggered by wml ([fire_event]), this made wesnoth.get_unit error (invalid argument)
  • Loading branch information
gfgtdf authored and GregoryLundberg committed Nov 30, 2017
1 parent cb9ae41 commit 2745084
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions data/lua/feeding.lua
Expand Up @@ -7,6 +7,11 @@ local on_event = wesnoth.require("on_event")
-- The feeding event code
on_event("die", function()
local ec = wesnoth.current.event_context

if not ec.x1 or not ec.y1 or not ec.x2 or not ec.y2 then
return
end

local u_killer = wesnoth.get_unit(ec.x2, ec.y2)
local u_victim = wesnoth.get_unit(ec.x1, ec.y1)

Expand Down

0 comments on commit 2745084

Please sign in to comment.