diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/defines.h | 2 | ||||
-rw-r--r-- | src/game-server/accountconnection.cpp | 2 | ||||
-rw-r--r-- | src/game-server/movingobject.hpp | 22 | ||||
-rw-r--r-- | src/game-server/spawnarea.cpp | 2 | ||||
-rw-r--r-- | src/game-server/state.cpp | 1 |
5 files changed, 18 insertions, 11 deletions
diff --git a/src/defines.h b/src/defines.h index 56d79797..c522889c 100644 --- a/src/defines.h +++ b/src/defines.h @@ -158,7 +158,7 @@ enum { PGMSG_WALK = 0x0260, // W*2 destination PGMSG_ACTION_CHANGE = 0x0270, // B Action GPMSG_BEING_ACTION_CHANGE = 0x0271, // W being id, B action - GPMSG_BEINGS_MOVE = 0x0280, // { W being id, B flags [, C position] [, W*2 destination] }* + GPMSG_BEINGS_MOVE = 0x0280, // { W being id, B flags [, C position, B speed] [, W*2 destination] }* GPMSG_ITEMS = 0x0281, // { W item id, W*2 position }* PGMSG_ATTACK = 0x0290, // B direction GPMSG_BEING_ATTACK = 0x0291, // W being id, B direction diff --git a/src/game-server/accountconnection.cpp b/src/game-server/accountconnection.cpp index 89d19187..842853b4 100644 --- a/src/game-server/accountconnection.cpp +++ b/src/game-server/accountconnection.cpp @@ -73,7 +73,7 @@ void AccountConnection::processMessage(MessageIn &msg) { std::string token = msg.readString(MAGIC_TOKEN_LENGTH); Character *ptr = new Character(msg); - ptr->setSpeed(150); // TODO + ptr->setSpeed(250); // TODO ptr->fillHitpoints();// TODO: the current hit points should be saved in the database. Otherwise players could heal their characters by logging in and out again. gameHandler->mTokenCollector.addPendingConnect(token, ptr); } break; diff --git a/src/game-server/movingobject.hpp b/src/game-server/movingobject.hpp index b1f4a33a..2763c530 100644 --- a/src/game-server/movingobject.hpp +++ b/src/game-server/movingobject.hpp @@ -41,8 +41,8 @@ class MovingObject : public Object MovingObject(int type, int id) : Object(type), mPublicID(id), - mDirection(0), - mActionTime(0) + mActionTime(0), + mDirection(0) {} /** @@ -77,25 +77,31 @@ class MovingObject : public Object /** * Gets object direction. */ - unsigned char getDirection() const + int getDirection() const { return mDirection; } /** + * Gets object speed. + */ + int getSpeed() const + { return mSpeed; } + + /** * Sets object speed. */ - void setSpeed(unsigned s) + void setSpeed(int s) { mSpeed = s; } /** * Sets object bounding circle radius. */ - void setSize(unsigned s) + void setSize(int s) { mSize = s; } /** * Gets object bounding circle radius. */ - unsigned getSize() + int getSize() { return mSize; } /** @@ -127,9 +133,9 @@ class MovingObject : public Object std::list<PATH_NODE> mPath; protected: - unsigned char mDirection; /**< Facing direction. */ unsigned short mActionTime; /**< Delay until next action. */ - unsigned mSize; /**< Radius of bounding circle. */ + unsigned char mDirection; /**< Facing direction. */ + unsigned char mSize; /**< Radius of bounding circle. */ }; #endif // _TMWSERV_MOVINGOBJECT_H_ diff --git a/src/game-server/spawnarea.cpp b/src/game-server/spawnarea.cpp index 3a6e9a17..47a98493 100644 --- a/src/game-server/spawnarea.cpp +++ b/src/game-server/spawnarea.cpp @@ -71,7 +71,7 @@ SpawnArea::update() being->addDeathListener(this); // some bogus stats for testing - being->setSpeed(150); + being->setSpeed(300); being->setSize(8); being->setAttribute(BASE_ATTR_VITALITY, 10); being->fillHitpoints(); diff --git a/src/game-server/state.cpp b/src/game-server/state.cpp index bcb93962..fa51972c 100644 --- a/src/game-server/state.cpp +++ b/src/game-server/state.cpp @@ -308,6 +308,7 @@ static void informPlayer(MapComposite *map, Character *p) if (flags & MOVING_POSITION) { moveMsg.writeCoordinates(opos.x / 32, opos.y / 32); + moveMsg.writeByte(o->getSpeed() / 10); } if (flags & MOVING_DESTINATION) { |