diff options
author | Reid <reidyaro@gmail.com> | 2012-01-25 22:05:36 +0100 |
---|---|---|
committer | Reid <reidyaro@gmail.com> | 2012-01-25 22:05:36 +0100 |
commit | 8b612abb42853a22c1a9545e2c9280d154646543 (patch) | |
tree | f466167087c2b2de4b8aa9e6d1d1986f72f84147 /src/map.cpp | |
parent | a913dd41df61760de6ece552f941e002251ff54c (diff) | |
parent | d340b5a27a8f3b05d1764da9c114f5f59bd0cd46 (diff) | |
download | manaplus-8b612abb42853a22c1a9545e2c9280d154646543.tar.gz manaplus-8b612abb42853a22c1a9545e2c9280d154646543.tar.bz2 manaplus-8b612abb42853a22c1a9545e2c9280d154646543.tar.xz manaplus-8b612abb42853a22c1a9545e2c9280d154646543.zip |
Merge branch 'master' of gitorious.org:manaplus/manaplus
Diffstat (limited to 'src/map.cpp')
-rw-r--r-- | src/map.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/map.cpp b/src/map.cpp index e706f120b..2209cf997 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -2,7 +2,7 @@ * The ManaPlus Client * Copyright (C) 2004-2009 The Mana World Development Team * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011 The ManaPlus Developers + * Copyright (C) 2011-2012 The ManaPlus Developers * * This file is part of The ManaPlus Client. * @@ -1383,17 +1383,20 @@ Path Map::findPath(int startX, int startY, int destX, int destY, if (startX >= mWidth || startY >= mHeight) return path; - // Declare open list, a list with open tiles sorted on F cost - std::priority_queue<Location> openList; - // Return when destination not walkable if (!getWalk(destX, destY, walkmask)) return path; // Reset starting tile's G cost to 0 MetaTile *startTile = &mMetaTiles[startX + startY * mWidth]; + if (!startTile) + return path; + startTile->Gcost = 0; + // Declare open list, a list with open tiles sorted on F cost + std::priority_queue<Location> openList; + // Add the start point to the open list openList.push(Location(startX, startY, startTile)); |