From 4a89b53153cc07edc42b27f18d372992b3d635d8 Mon Sep 17 00:00:00 2001
From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54>
Date: Tue, 24 Aug 2010 15:52:53 +0000
Subject: [PATCH] fix

git-svn-id: http://svn.net-core.org/repos/t-engine4@1055 51575b47-30f0-44d4-a5cc-537603b46e54
---
 game/engine/ai/simple.lua | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/game/engine/ai/simple.lua b/game/engine/ai/simple.lua
index 7e7e321d3b..58b2957c08 100644
--- a/game/engine/ai/simple.lua
+++ b/game/engine/ai/simple.lua
@@ -59,7 +59,7 @@ newAI("flee_dmap", function(self)
 			local sx, sy = util.coordAddDir(self.x, self.y, i)
 			local cd = a:distanceMap(sx, sy)
 --			print("looking for dmap", dir, i, "::", c, cd)
-			if not cd or (cd < c and self:canMove(sx, sy)) then c = cd; dir = i end
+			if not cd or (c and (cd < c and self:canMove(sx, sy))) then c = cd; dir = i end
 		end
 
 		return self:moveDirection(util.coordAddDir(self.x, self.y, dir))
-- 
GitLab