summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-07-25 20:26:46 +0000
committerGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-07-25 20:26:46 +0000
commit7354937c4b452a2c413f0827d6f381e125e6a687 (patch)
tree84792355a26f5b4c38996b16c12df090fa8f8926
parent6ba73b56b72bf53d4976fd1423490e682542b6d2 (diff)
downloadmanaserv-7354937c4b452a2c413f0827d6f381e125e6a687.tar.gz
manaserv-7354937c4b452a2c413f0827d6f381e125e6a687.tar.bz2
manaserv-7354937c4b452a2c413f0827d6f381e125e6a687.tar.xz
manaserv-7354937c4b452a2c413f0827d6f381e125e6a687.zip
Added being speed to protocol.
-rw-r--r--ChangeLog10
-rw-r--r--src/defines.h2
-rw-r--r--src/game-server/accountconnection.cpp2
-rw-r--r--src/game-server/movingobject.hpp22
-rw-r--r--src/game-server/spawnarea.cpp2
-rw-r--r--src/game-server/state.cpp1
6 files changed, 28 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index e8361212..d2000b55 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2007-07-25 Guillaume Melquiond <guillaume.melquiond@gmail.com>
+
+ * src/game-server/movingobject.hpp: Added missing accessor, compacted
+ object, and used generic integer in signatures.
+ * src/defines.h, src/game-server/state.cpp: Added being speed to
+ protocol.
+ * src/game-server/spawnarea.cpp, src/game-server/accountconnection.cpp:
+ Halved speed of maggots. Reduced speed of characters, so that they do
+ not travel much more than one tile per data round-trip.
+
2007-07-25 Bjørn Lindeijer <bjorn@lindeijer.nl>
* src/chat-server/chathandler.hpp,
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)
{