diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-01-03 19:54:16 +0100 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-01-03 19:54:16 +0100 |
commit | 8404033af0218ccd0221bf6ae9c0939bec86c4c9 (patch) | |
tree | c3958616add91c47291d0d366b66af980d5bcc3a | |
parent | ac0a394505c0cf1124f48e4700e214d337c2e527 (diff) | |
download | manaserv-8404033af0218ccd0221bf6ae9c0939bec86c4c9.tar.gz manaserv-8404033af0218ccd0221bf6ae9c0939bec86c4c9.tar.xz manaserv-8404033af0218ccd0221bf6ae9c0939bec86c4c9.zip |
Got rid of the superfluous DEFAULT_TILE_HEIGHT/WIDTH.
We've got DEFAULT_TILE_LENGTH in defines.h for that.
Trivial fix.
-rw-r--r-- | src/game-server/gamehandler.cpp | 4 | ||||
-rw-r--r-- | src/game-server/map.cpp | 5 | ||||
-rw-r--r-- | src/game-server/map.h | 7 | ||||
-rw-r--r-- | src/game-server/mapreader.cpp | 4 |
4 files changed, 10 insertions, 10 deletions
diff --git a/src/game-server/gamehandler.cpp b/src/game-server/gamehandler.cpp index 7aae2e2..a909728 100644 --- a/src/game-server/gamehandler.cpp +++ b/src/game-server/gamehandler.cpp @@ -136,7 +136,7 @@ static Actor *findActorNear(Actor *p, int id) MapComposite *map = p->getMap(); const Point &ppos = p->getPosition(); // See map.h for tiles constants - const int pixelDist = DEFAULT_TILE_WIDTH * TILES_TO_BE_NEAR; + const int pixelDist = DEFAULT_TILE_LENGTH * TILES_TO_BE_NEAR; for (ActorIterator i(map->getAroundPointIterator(ppos, pixelDist)); i; ++i) { Actor *a = *i; @@ -152,7 +152,7 @@ static Character *findCharacterNear(Actor *p, int id) MapComposite *map = p->getMap(); const Point &ppos = p->getPosition(); // See map.h for tiles constants - const int pixelDist = DEFAULT_TILE_WIDTH * TILES_TO_BE_NEAR; + const int pixelDist = DEFAULT_TILE_LENGTH * TILES_TO_BE_NEAR; for (CharacterIterator i(map->getAroundPointIterator(ppos, pixelDist)); i; ++i) { diff --git a/src/game-server/map.cpp b/src/game-server/map.cpp index 1464402..8a3c3e6 100644 --- a/src/game-server/map.cpp +++ b/src/game-server/map.cpp @@ -25,6 +25,8 @@ #include "game-server/map.h" +#include "defines.h" + // Basic cost for moving from one tile to another. // Used in findPath() function when computing the A* path algorithm. static int const basicCost = 100; @@ -43,7 +45,8 @@ bool Location::operator< (const Location &loc) const return tile->Fcost > loc.tile->Fcost; } -Map::Map(int width, int height, int twidth, int theight): +Map::Map(int width = 0, int height = 0, + int twidth = DEFAULT_TILE_LENGTH, int theight = DEFAULT_TILE_LENGTH): mWidth(width), mHeight(height), mTileWidth(twidth), mTileHeight(theight), onClosedList(1), onOpenList(2) diff --git a/src/game-server/map.h b/src/game-server/map.h index fab5baa..ba46f73 100644 --- a/src/game-server/map.h +++ b/src/game-server/map.h @@ -25,9 +25,6 @@ #include <map> #include <string> -const unsigned int DEFAULT_TILE_WIDTH = 32; -const unsigned int DEFAULT_TILE_HEIGHT = 32; - /** * A position along a being's path. * Used to compute each Path Nodes of the path. @@ -106,8 +103,8 @@ class Map /** * Constructor that takes initial map size as parameters. */ - Map(int width = 0, int height = 0, - int twidth = DEFAULT_TILE_WIDTH, int theight = DEFAULT_TILE_HEIGHT); + Map(int width, int height, + int twidth, int theight); /** * Destructor. diff --git a/src/game-server/mapreader.cpp b/src/game-server/mapreader.cpp index f9010fb..2a26895 100644 --- a/src/game-server/mapreader.cpp +++ b/src/game-server/mapreader.cpp @@ -120,8 +120,8 @@ Map* MapReader::readMap(xmlNodePtr node, const std::string &path, std::string pathDir = path.substr(0, path.rfind("/") + 1); int w = XML::getProperty(node, "width", 0); int h = XML::getProperty(node, "height", 0); - int tilew = XML::getProperty(node, "tilewidth", DEFAULT_TILE_WIDTH); - int tileh = XML::getProperty(node, "tileheight", DEFAULT_TILE_HEIGHT); + int tilew = XML::getProperty(node, "tilewidth", DEFAULT_TILE_LENGTH); + int tileh = XML::getProperty(node, "tileheight", DEFAULT_TILE_LENGTH); Map* map = new Map(w, h, tilew, tileh); for (node = node->xmlChildrenNode; node != NULL; node = node->next) |