summaryrefslogtreecommitdiff
path: root/src/game-server
diff options
context:
space:
mode:
Diffstat (limited to 'src/game-server')
-rw-r--r--src/game-server/gamehandler.cpp4
-rw-r--r--src/game-server/map.cpp5
-rw-r--r--src/game-server/map.h7
-rw-r--r--src/game-server/mapreader.cpp4
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 <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 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)