diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-07-02 16:13:21 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-07-02 16:13:21 +0000 |
commit | 249a3d864e1343bcb0304e8a73d31f78a2a00d30 (patch) | |
tree | 73a96a248942866d2219b933aa427b8086698493 /src | |
parent | 3ff0ca5a474987292735c9b893fdedfbd44d03b9 (diff) | |
download | mana-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')
-rw-r--r-- | src/base64.h | 6 | ||||
-rw-r--r-- | src/configuration.h | 4 | ||||
-rw-r--r-- | src/map.cpp | 49 |
3 files changed, 37 insertions, 22 deletions
diff --git a/src/base64.h b/src/base64.h index 2e5bd69e..5b275c45 100644 --- a/src/base64.h +++ b/src/base64.h @@ -28,13 +28,13 @@ */ /* $Id$ */ -#ifndef _BASE64_h -#define _BASE64_h +#ifndef _TMW_BASE64_H +#define _TMW_BASE64_H extern unsigned char *php_base64_encode(const unsigned char *, int, int *); extern unsigned char *php_base64_decode(const unsigned char *, int, int *); -#endif /* _BASE64_h */ +#endif /* _TMW_BASE64_H */ /* * Local variables: diff --git a/src/configuration.h b/src/configuration.h index 75699f30..f76f0837 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -21,8 +21,8 @@ * $Id$ */ -#ifndef __INIREAD_H -#define __INIREAD_H +#ifndef _TMW_CONFIGURATION_H +#define _TMW_CONFIGURATION_H #include <map> #include <list> 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; |