Fix issue #77 and improve findPath

This commit is contained in:
Eduardo Bart
2012-08-21 23:10:56 -03:00
parent 3d7e80ea7a
commit 64d607b59e
7 changed files with 64 additions and 25 deletions

View File

@@ -160,9 +160,9 @@ function onMinimapMouseRelease(self, mousePosition, mouseButton)
navigating = false
return
end
local tile = self:getTile(mousePosition)
if tile and mouseButton == MouseLeftButton and self:isPressed() then
local dirs = g_map.findPath(g_game.getLocalPlayer():getPosition(), tile:getPosition(), 127)
local pos = self:getPosition(mousePosition)
if pos and mouseButton == MouseLeftButton and self:isPressed() then
local dirs = g_map.findPath(g_game.getLocalPlayer():getPosition(), pos, 127, PathFindFlags.AllowNullTiles)
if #dirs == 0 then
modules.game_textmessage.displayStatusMessage(tr('There is no way.'))
return true