summaryrefslogtreecommitdiff
path: root/src/map.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-10-02 13:38:27 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-10-02 13:38:27 +0000
commit4df1759a3636108839f9533268c8ce1b7156e132 (patch)
treec8ce12529845eecb930907829ca1ad3805f79628 /src/map.cpp
parentfcaec2c34641a5dc3da7423e81ad7b1415fe078d (diff)
downloadmana-4df1759a3636108839f9533268c8ce1b7156e132.tar.gz
mana-4df1759a3636108839f9533268c8ce1b7156e132.tar.bz2
mana-4df1759a3636108839f9533268c8ce1b7156e132.tar.xz
mana-4df1759a3636108839f9533268c8ce1b7156e132.zip
Added check for pthread library (needed for FreeBSD, still needs to be checked
on MacOS X) and some cleanups.
Diffstat (limited to 'src/map.cpp')
-rw-r--r--src/map.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/map.cpp b/src/map.cpp
index e74a3203..583a01be 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -25,6 +25,7 @@
#include "tileset.h"
#include "being.h"
#include "graphics.h"
+#include "resources/image.h"
#include <queue>
@@ -103,7 +104,9 @@ Map::draw(Graphics *graphics, int scrollX, int scrollY, int layer)
{
Image *img = getTile(x, y, layer);
if (img) {
- graphics->drawImage(img, x * 32 - scrollX, y * 32 - scrollY);
+ graphics->drawImage(img,
+ x * 32 - scrollX,
+ y * 32 - scrollY + 32 - img->getHeight());
}
}
}
@@ -251,7 +254,7 @@ Map::findPath(int startX, int startY, int destX, int destY)
// Declare open list, a list with open tiles sorted on F cost
std::priority_queue<Location> openList;
- // Return when destination not walkable
+ // Return empty path when destination not walkable
if (!getWalk(destX, destY)) return path;
// Reset starting tile's G cost to 0
@@ -266,8 +269,7 @@ Map::findPath(int startX, int startY, int destX, int destY)
// Keep trying new open tiles until no more tiles to try or target found
while (!openList.empty() && !foundPath)
{
- // Take the location with the lowest F cost from the open list, and
- // add it to the closed list.
+ // Take the location with the lowest F cost from the open list.
Location curr = openList.top();
openList.pop();