diff options
-rw-r--r-- | accountserver.cbp | 2 | ||||
-rw-r--r-- | gameserver.cbp | 2 | ||||
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/account-server/accounthandler.cpp | 2 | ||||
-rw-r--r-- | src/account-server/character.h | 2 | ||||
-rw-r--r-- | src/account-server/storage.cpp | 5 | ||||
-rw-r--r-- | src/game-server/actor.h | 2 | ||||
-rw-r--r-- | src/game-server/being.cpp | 5 | ||||
-rw-r--r-- | src/game-server/collisiondetection.cpp | 2 | ||||
-rw-r--r-- | src/game-server/map.cpp | 4 | ||||
-rw-r--r-- | src/game-server/map.h | 16 | ||||
-rw-r--r-- | src/game-server/mapcomposite.cpp | 2 | ||||
-rw-r--r-- | src/game-server/spawnarea.h | 2 | ||||
-rw-r--r-- | src/game-server/state.cpp | 2 | ||||
-rw-r--r-- | src/game-server/trigger.h | 2 | ||||
-rw-r--r-- | src/serialize/characterdata.h | 2 | ||||
-rw-r--r-- | src/utils/point.h (renamed from src/point.h) | 18 |
17 files changed, 31 insertions, 41 deletions
diff --git a/accountserver.cbp b/accountserver.cbp index d95bd44..5b9e1d4 100644 --- a/accountserver.cbp +++ b/accountserver.cbp @@ -143,7 +143,7 @@ <Unit filename="src\net\messageout.h" /> <Unit filename="src\net\netcomputer.cpp" /> <Unit filename="src\net\netcomputer.h" /> - <Unit filename="src\point.h" /> + <Unit filename="src\utils\point.h" /> <Unit filename="src\protocol.h" /> <Unit filename="src\serialize\characterdata.h" /> <Unit filename="src\utils\base64.cpp" /> diff --git a/gameserver.cbp b/gameserver.cbp index cc1f680..4f700b9 100644 --- a/gameserver.cbp +++ b/gameserver.cbp @@ -171,7 +171,7 @@ <Unit filename="src\net\messageout.h" /> <Unit filename="src\net\netcomputer.cpp" /> <Unit filename="src\net\netcomputer.h" /> - <Unit filename="src\point.h" /> + <Unit filename="src\utils\point.h" /> <Unit filename="src\protocol.h" /> <Unit filename="src\scripting\lua.cpp" /> <Unit filename="src\scripting\luascript.cpp" /> diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0ab2272..cf04d39 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -102,7 +102,6 @@ MARK_AS_ADVANCED(PHYSFS_LIBRARY) SET(SRCS defines.h manaserv_protocol.h - point.h common/configuration.h common/configuration.cpp common/inventorydata.h @@ -123,6 +122,7 @@ SET(SRCS serialize/characterdata.h utils/logger.h utils/logger.cpp + utils/point.h utils/processorutils.h utils/processorutils.cpp utils/string.h diff --git a/src/account-server/accounthandler.cpp b/src/account-server/accounthandler.cpp index 22deafa..9948f1e 100644 --- a/src/account-server/accounthandler.cpp +++ b/src/account-server/accounthandler.cpp @@ -21,7 +21,6 @@ #include "account-server/accounthandler.h" #include "manaserv_protocol.h" -#include "point.h" #include "account-server/account.h" #include "account-server/accountclient.h" #include "account-server/character.h" @@ -37,6 +36,7 @@ #include "net/netcomputer.h" #include "utils/functors.h" #include "utils/logger.h" +#include "utils/point.h" #include "utils/stringfilter.h" #include "utils/tokencollector.h" #include "utils/tokendispenser.h" diff --git a/src/account-server/character.h b/src/account-server/character.h index a0d4b61..daa8a31 100644 --- a/src/account-server/character.h +++ b/src/account-server/character.h @@ -26,8 +26,8 @@ #include <map> #include "defines.h" -#include "point.h" #include "common/inventorydata.h" +#include "utils/point.h" class Account; class MessageIn; diff --git a/src/account-server/storage.cpp b/src/account-server/storage.cpp index 448fc28..9bc67ed 100644 --- a/src/account-server/storage.cpp +++ b/src/account-server/storage.cpp @@ -23,7 +23,6 @@ #include "account-server/storage.h" -#include "point.h" #include "account-server/account.h" #include "chat-server/chatchannel.h" #include "chat-server/guild.h" @@ -32,6 +31,7 @@ #include "dal/dalexcept.h" #include "dal/dataproviderfactory.h" #include "utils/functors.h" +#include "utils/point.h" #include "utils/throwerror.h" #include "utils/xml.h" @@ -333,6 +333,7 @@ Character *Storage::getCharacterBySQL(Account *owner) // Specialize the string_to functor to convert // a string to an unsigned int. string_to< unsigned > toUint; + string_to< int > toInt; try { @@ -355,7 +356,7 @@ Character *Storage::getCharacterBySQL(Account *owner) character->setLevel(toUshort(charInfo(0, 6))); character->setCharacterPoints(toUshort(charInfo(0, 7))); character->setCorrectionPoints(toUshort(charInfo(0, 8))); - Point pos(toUshort(charInfo(0, 9)), toUshort(charInfo(0, 10))); + Point pos(toInt(charInfo(0, 9)), toInt(charInfo(0, 10))); character->setPosition(pos); int mapId = toUint(charInfo(0, 11)); diff --git a/src/game-server/actor.h b/src/game-server/actor.h index fa44355..3aac3b6 100644 --- a/src/game-server/actor.h +++ b/src/game-server/actor.h @@ -21,9 +21,9 @@ #ifndef ACTOR_H #define ACTOR_H -#include "point.h" #include "game-server/map.h" #include "game-server/thing.h" +#include "utils/point.h" /** * Flags that are raised as necessary. They trigger messages that are sent to diff --git a/src/game-server/being.cpp b/src/game-server/being.cpp index c0fc65e..6573677 100644 --- a/src/game-server/being.cpp +++ b/src/game-server/being.cpp @@ -270,16 +270,17 @@ void Being::move() setAction(WALK); - Position prev(tileSX, tileSY); + Point prev(tileSX, tileSY); Point pos; do { - Position next = mPath.front(); + Point next = mPath.front(); mPath.pop_front(); // SQRT2 is used for diagonal movement. mMoveTime += (prev.x == next.x || prev.y == next.y) ? getModifiedAttribute(ATTR_MOVE_SPEED_RAW) : getModifiedAttribute(ATTR_MOVE_SPEED_RAW) * SQRT2; + if (mPath.empty()) { // skip last tile center diff --git a/src/game-server/collisiondetection.cpp b/src/game-server/collisiondetection.cpp index 55e40d6..9aab4c5 100644 --- a/src/game-server/collisiondetection.cpp +++ b/src/game-server/collisiondetection.cpp @@ -22,8 +22,8 @@ #include <cmath> -#include "point.h" #include "utils/mathutils.h" +#include "utils/point.h" #define D_TO_R 0.0174532925 // PI / 180 #define R_TO_D 57.2957795 // 180 / PI diff --git a/src/game-server/map.cpp b/src/game-server/map.cpp index 8a3c3e6..e1cebd0 100644 --- a/src/game-server/map.cpp +++ b/src/game-server/map.cpp @@ -203,7 +203,7 @@ Path Map::findSimplePath(int startX, int startY, if (getWalk(positionX, positionY, walkmask)) { - path.push_back(Position(positionX, positionY)); + path.push_back(Point(positionX, positionY)); if ((positionX == destX) && (positionY == destY)) { @@ -374,7 +374,7 @@ Path Map::findPath(int startX, int startY, while (pathX != startX || pathY != startY) { // Add the new path node to the start of the path list - path.push_front(Position(pathX, pathY)); + path.push_front(Point(pathX, pathY)); // Find out the next parent MetaTile *tile = getMetaTile(pathX, pathY); diff --git a/src/game-server/map.h b/src/game-server/map.h index ba46f73..c5be38c 100644 --- a/src/game-server/map.h +++ b/src/game-server/map.h @@ -25,21 +25,9 @@ #include <map> #include <string> -/** - * A position along a being's path. - * Used to compute each Path Nodes of the path. - */ -struct Position -{ - Position(int x, int y): - x(x), y(y) - { } - - int x; - int y; -}; +#include "utils/point.h" -typedef std::list<Position> Path; +typedef std::list<Point> Path; typedef Path::iterator PathIterator; /** diff --git a/src/game-server/mapcomposite.cpp b/src/game-server/mapcomposite.cpp index b5a950b..ae88a37 100644 --- a/src/game-server/mapcomposite.cpp +++ b/src/game-server/mapcomposite.cpp @@ -21,13 +21,13 @@ #include <algorithm> #include <cassert> -#include "point.h" #include "common/configuration.h" #include "game-server/map.h" #include "game-server/mapcomposite.h" #include "game-server/character.h" #include "scripting/script.h" #include "utils/logger.h" +#include "utils/point.h" /* TODO: Implement overlapping map zones instead of strict partitioning. Purpose: to decrease the number of zone changes, as overlapping allows for diff --git a/src/game-server/spawnarea.h b/src/game-server/spawnarea.h index d3b2fd0..48bfede 100644 --- a/src/game-server/spawnarea.h +++ b/src/game-server/spawnarea.h @@ -21,9 +21,9 @@ #ifndef SPAWNAREA_H #define SPAWNAREA_H -#include "point.h" #include "game-server/eventlistener.h" #include "game-server/thing.h" +#include "utils/point.h" class Being; class MonsterClass; diff --git a/src/game-server/state.cpp b/src/game-server/state.cpp index c652549..bed4780 100644 --- a/src/game-server/state.cpp +++ b/src/game-server/state.cpp @@ -22,7 +22,6 @@ #include "game-server/state.h" -#include "point.h" #include "common/configuration.h" #include "game-server/accountconnection.h" #include "game-server/gamehandler.h" @@ -39,6 +38,7 @@ #include "net/messageout.h" #include "scripting/script.h" #include "utils/logger.h" +#include "utils/point.h" #include "utils/speedconv.h" enum diff --git a/src/game-server/trigger.h b/src/game-server/trigger.h index f6649f1..f6f0e17 100644 --- a/src/game-server/trigger.h +++ b/src/game-server/trigger.h @@ -21,9 +21,9 @@ #ifndef TRIGGER_H #define TRIGGER_H -#include "point.h" #include "game-server/thing.h" #include "scripting/script.h" +#include "utils/point.h" class Actor; diff --git a/src/serialize/characterdata.h b/src/serialize/characterdata.h index f36581d..009d0ef 100644 --- a/src/serialize/characterdata.h +++ b/src/serialize/characterdata.h @@ -27,7 +27,7 @@ #include "common/inventorydata.h" #include "net/messagein.h" #include "net/messageout.h" -#include "point.h" +#include "utils/point.h" template< class T > void serializeCharacterData(const T &data, MessageOut &msg) diff --git a/src/point.h b/src/utils/point.h index 7d1bead..0ebc37c 100644 --- a/src/point.h +++ b/src/utils/point.h @@ -33,12 +33,12 @@ class Point x(0), y(0) {} - Point(unsigned short X, unsigned short Y): + Point(int X, int Y): x(X), y(Y) {} - unsigned short x; /**< x coordinate */ - unsigned short y; /**< y coordinate */ + int x; /**< x coordinate */ + int y; /**< y coordinate */ /** * Check whether the given point is within range of this point. @@ -67,15 +67,15 @@ class Point class Rectangle { public: - unsigned short x; /**< x coordinate */ - unsigned short y; /**< y coordinate */ - unsigned short w; /**< width */ - unsigned short h; /**< height */ + int x; /**< x coordinate */ + int y; /**< y coordinate */ + int w; /**< width */ + int h; /**< height */ bool contains(const Point &p) const { - return (unsigned short)(p.x - x) < w && - (unsigned short)(p.y - y) < h; + return (p.x - x) < w && + (p.y - y) < h; } bool intersects(const Rectangle &r) const |