From 8404033af0218ccd0221bf6ae9c0939bec86c4c9 Mon Sep 17 00:00:00 2001 From: Yohann Ferreira Date: Mon, 3 Jan 2011 19:54:16 +0100 Subject: Got rid of the superfluous DEFAULT_TILE_HEIGHT/WIDTH. We've got DEFAULT_TILE_LENGTH in defines.h for that. Trivial fix. --- src/game-server/gamehandler.cpp | 4 ++-- src/game-server/map.cpp | 5 ++++- src/game-server/map.h | 7 ++----- 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 7aae2e2c..a9097286 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 14644026..8a3c3e63 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 fab5baaf..ba46f737 100644 --- a/src/game-server/map.h +++ b/src/game-server/map.h @@ -25,9 +25,6 @@ #include #include -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 f9010fb1..2a26895d 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) -- cgit v1.2.3-70-g09d2