summaryrefslogtreecommitdiff
path: root/src/map.cpp
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-03-29 01:26:56 +0200
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-03-29 01:26:56 +0200
commit15c69030f987bd7d67fdbaf2158b2c3ae430143f (patch)
treea8ec211017aad38cd9784c1c837cada34eab3dfe /src/map.cpp
parentce94f62be91c98310281b33dbc7f4b79fd4e8052 (diff)
downloadmana-15c69030f987bd7d67fdbaf2158b2c3ae430143f.tar.gz
mana-15c69030f987bd7d67fdbaf2158b2c3ae430143f.tar.bz2
mana-15c69030f987bd7d67fdbaf2158b2c3ae430143f.tar.xz
mana-15c69030f987bd7d67fdbaf2158b2c3ae430143f.zip
Added the Map::getTileCenter() convenience function.
and made use of it through the tA code. I also remove the obsolete TODO in the flooritem class.
Diffstat (limited to 'src/map.cpp')
-rw-r--r--src/map.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/map.cpp b/src/map.cpp
index 78171ca9..949b00bd 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -607,6 +607,18 @@ bool Map::occupied(int x, int y) const
return false;
}
+Vector Map::getTileCenter(int x, int y)
+{
+ Vector tileCenterPos;
+
+ if (!contains(x, y))
+ return tileCenterPos;
+
+ tileCenterPos.x = x * mTileWidth + mTileWidth / 2;
+ tileCenterPos.y = y * mTileHeight + mTileHeight / 2;
+ return tileCenterPos;
+}
+
bool Map::contains(int x, int y) const
{
return x >= 0 && y >= 0 && x < mWidth && y < mHeight;