summaryrefslogtreecommitdiff
path: root/src/map.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-07-02 16:13:21 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-07-02 16:13:21 +0000
commit249a3d864e1343bcb0304e8a73d31f78a2a00d30 (patch)
tree73a96a248942866d2219b933aa427b8086698493 /src/map.cpp
parent3ff0ca5a474987292735c9b893fdedfbd44d03b9 (diff)
downloadmana-249a3d864e1343bcb0304e8a73d31f78a2a00d30.tar.gz
mana-249a3d864e1343bcb0304e8a73d31f78a2a00d30.tar.bz2
mana-249a3d864e1343bcb0304e8a73d31f78a2a00d30.tar.xz
mana-249a3d864e1343bcb0304e8a73d31f78a2a00d30.zip
Added minimap to Tulimshar (map 3-1)
Diffstat (limited to 'src/map.cpp')
-rw-r--r--src/map.cpp49
1 files changed, 32 insertions, 17 deletions
diff --git a/src/map.cpp b/src/map.cpp
index 24c9b5b4..6e4bf62d 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -72,7 +72,8 @@ Map::~Map()
delete[] tiles;
}
-void Map::setSize(int width, int height)
+void
+Map::setSize(int width, int height)
{
this->width = width;
this->height = height;
@@ -82,7 +83,8 @@ void Map::setSize(int width, int height)
tiles = new Image*[width * height * 3];
}
-void Map::draw(Graphics *graphics, int scrollX, int scrollY, int layer)
+void
+Map::draw(Graphics *graphics, int scrollX, int scrollY, int layer)
{
int startX = scrollX / 32;
int startY = scrollY / 32;
@@ -106,12 +108,14 @@ void Map::draw(Graphics *graphics, int scrollX, int scrollY, int layer)
}
}
-void Map::setWalk(int x, int y, bool walkable)
+void
+Map::setWalk(int x, int y, bool walkable)
{
metaTiles[x + y * width].walkable = walkable;
}
-bool Map::getWalk(int x, int y)
+bool
+Map::getWalk(int x, int y)
{
// If walkable, check for colliding into a being
if (!tileCollides(x, y)) {
@@ -131,7 +135,8 @@ bool Map::getWalk(int x, int y)
}
}
-bool Map::tileCollides(int x, int y)
+bool
+Map::tileCollides(int x, int y)
{
// You can't walk outside of the map
if (x < 0 || y < 0 || x >= width || y >= height) {
@@ -142,42 +147,50 @@ bool Map::tileCollides(int x, int y)
return !metaTiles[x + y * width].walkable;
}
-void Map::setTile(int x, int y, int layer, Image *img)
+void
+Map::setTile(int x, int y, int layer, Image *img)
{
tiles[x + y * width + layer * (width * height)] = img;
}
-Image *Map::getTile(int x, int y, int layer)
+Image*
+Map::getTile(int x, int y, int layer)
{
return tiles[x + y * width + layer * (width * height)];
}
-MetaTile *Map::getMetaTile(int x, int y)
+MetaTile*
+Map::getMetaTile(int x, int y)
{
return &metaTiles[x + y * width];
}
-int Map::getWidth()
+int
+Map::getWidth()
{
return width;
}
-int Map::getHeight()
+int
+Map::getHeight()
{
return height;
}
-int Map::getTileWidth()
+int
+Map::getTileWidth()
{
return tileWidth;
}
-int Map::getTileHeight()
+int
+Map::getTileHeight()
{
return tileHeight;
}
-std::string Map::getProperty(const std::string &name)
+std::string
+Map::getProperty(const std::string &name)
{
std::map<std::string,std::string>::iterator i = properties.find(name);
@@ -189,18 +202,20 @@ std::string Map::getProperty(const std::string &name)
return "";
}
-bool Map::hasProperty(const std::string &name)
+bool
+Map::hasProperty(const std::string &name)
{
return (properties.find(name) != properties.end());
}
-void Map::setProperty(const std::string &name, const std::string &value)
+void
+Map::setProperty(const std::string &name, const std::string &value)
{
properties[name] = value;
}
-std::list<PATH_NODE> Map::findPath(
- int startX, int startY, int destX, int destY)
+std::list<PATH_NODE>
+Map::findPath(int startX, int startY, int destX, int destY)
{
// Path to be built up (empty by default)
std::list<PATH_NODE> path;