Skip to content

Commit

Permalink
Experimental AI: remove potential of causing errors through WML events
Browse files Browse the repository at this point in the history
Events taking units off the map after the move could previously have
caused errors, and thus disabled the AI for the rest of the turn.
  • Loading branch information
mattsc committed Feb 28, 2014
1 parent cb86f5e commit 0b6fa7e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions data/ai/lua/generic_rush_engine.lua
Expand Up @@ -493,6 +493,8 @@ return {
local defender = wesnoth.get_unit(self.data.attack.target.x, self.data.attack.target.y)

AH.movefull_stopunit(ai, attacker, self.data.attack.dst.x, self.data.attack.dst.y)
if (not attacker) or (not attacker.valid) then return end
if (not defender) or (not defender.valid) then return end

-- Find the poison weapon
-- If several attacks have poison, this will always find the last one
Expand Down

0 comments on commit 0b6fa7e

Please sign in to comment.