LoW: fixed a Lua error in Ka'lian Under Attack, as reported in the forums

This commit is contained in:
Elvish_Hunter 2011-12-16 10:47:52 +00:00
parent 34cef6dced
commit 06e86684fc
2 changed files with 5 additions and 3 deletions

View file

@ -27,6 +27,8 @@ Version 1.9.12+svn:
* Caverns of Flame: integrated a sighted event with moveto event
* Son of the Black Eye:
* The Desert of Death: integrated a sighted event with moveto event
* Legend of Wesmere:
* Ka'lian Under Attack: fixed a lua error in AI code
* Language and i18n:
* Updated translations: British English, Czech, Dutch, French, Galician,
German, Korean, Lithuanian, Old English, Polish, Russian, Serbian

View file

@ -195,9 +195,9 @@
function my_ai:retreat()
local urudin = wesnoth.get_units({side = 3, id="Urudin"})[1]
local mhp, hp = urudin.max_hitpoints, urudin.hitpoints
local turn = wesnoth.current.turn
if urudin then
if urudin and urudin.valid then
local mhp, hp = urudin.max_hitpoints, urudin.hitpoints
local turn = wesnoth.current.turn
if turn >= 3 or hp < mhp / 2 then
ai.move_full(urudin, 20, 6)
end