diff options
author | Chuck Miller <shadowmil@gmail.com> | 2009-08-01 00:11:09 -0400 |
---|---|---|
committer | Chuck Miller <shadowmil@gmail.com> | 2009-08-01 02:08:44 -0400 |
commit | 81c4f300074d2b6ff0efd2f581adcb700d8eed65 (patch) | |
tree | a8f6dce5bc6ce4f291f4fa1164ed647640cc49a7 /src | |
parent | 4a6fb7b837489280e9ace18a5e7c20a200986f0c (diff) | |
download | manaserv-81c4f300074d2b6ff0efd2f581adcb700d8eed65.tar.gz manaserv-81c4f300074d2b6ff0efd2f581adcb700d8eed65.tar.bz2 manaserv-81c4f300074d2b6ff0efd2f581adcb700d8eed65.tar.xz manaserv-81c4f300074d2b6ff0efd2f581adcb700d8eed65.zip |
Simplifies Movement to not send path destinations, but rather just the current pos
Diffstat (limited to 'src')
-rw-r--r-- | src/defines.h | 2 | ||||
-rw-r--r-- | src/game-server/character.cpp | 9 | ||||
-rw-r--r-- | src/game-server/character.hpp | 5 | ||||
-rw-r--r-- | src/game-server/state.cpp | 30 |
4 files changed, 6 insertions, 40 deletions
diff --git a/src/defines.h b/src/defines.h index d281be13..a3a7e2f9 100644 --- a/src/defines.h +++ b/src/defines.h @@ -149,7 +149,7 @@ enum { PGMSG_DIRECTION_CHANGE = 0x0272, // B Direction GPMSG_BEING_DIR_CHANGE = 0x0273, // W being id, B direction GPMSG_BEING_HEALTH_CHANGE = 0x0274, // W being id, W health - GPMSG_BEINGS_MOVE = 0x0280, // { W being id, B flags [, C position, B speed] [, W*2 destination] }* + GPMSG_BEINGS_MOVE = 0x0280, // { W being id, B flags [, W*2 position, B speed] }* GPMSG_ITEMS = 0x0281, // { W item id, W*2 position }* PGMSG_ATTACK = 0x0290, // W being id GPMSG_BEING_ATTACK = 0x0291, // W being id, B direction, B attacktype diff --git a/src/game-server/character.cpp b/src/game-server/character.cpp index 9d25e42e..88f9aec8 100644 --- a/src/game-server/character.cpp +++ b/src/game-server/character.cpp @@ -128,15 +128,6 @@ void Character::update() Being::update(); } -std::list<PATH_NODE> Character::findPath() -{ - mOld = getPosition(); - int startX = mOld.x / 32, startY = mOld.y / 32; - int destX = mDst.x / 32, destY = mDst.y / 32; - Map *map = getMap()->getMap(); - return map->findSimplePath(startX, startY, destX, destY, getWalkMask()); -} - void Character::perform() { if (mAction != ATTACK || mTarget == NULL) return; diff --git a/src/game-server/character.hpp b/src/game-server/character.hpp index ea979184..a5616480 100644 --- a/src/game-server/character.hpp +++ b/src/game-server/character.hpp @@ -77,11 +77,6 @@ class Character : public Being void respawn(); /** - * Returns the path to the character's current destination. - */ - std::list<PATH_NODE> findPath(); - - /** * makes the character perform a special action * when it is allowed to do so */ diff --git a/src/game-server/state.cpp b/src/game-server/state.cpp index 9df353a1..dcfb9139 100644 --- a/src/game-server/state.cpp +++ b/src/game-server/state.cpp @@ -267,15 +267,12 @@ static void informPlayer(MapComposite *map, Character *p) if (!wereInRange) { // o is now visible by p. Send enter message. - flags |= MOVING_POSITION; - flags |= MOVING_DESTINATION; - MessageOut enterMsg(GPMSG_BEING_ENTER); enterMsg.writeByte(otype); enterMsg.writeShort(oid); enterMsg.writeByte(static_cast< Being *>(o)->getAction()); - enterMsg.writeShort(opos.x); // aren't these two lines redundand considering - enterMsg.writeShort(opos.y); // that a MOVING_POSITION message is following? + enterMsg.writeShort(opos.x); + enterMsg.writeShort(opos.y); switch (otype) { case OBJECT_CHARACTER: @@ -308,22 +305,9 @@ static void informPlayer(MapComposite *map, Character *p) gameHandler->sendTo(p, enterMsg); } - /* At this point, either o has entered p's range, either o is - moving inside p's range. Report o's movements. */ - - Point odst = o->getDestination(); - if (opos != odst) + if (opos != oold) { flags |= MOVING_POSITION; - if (oflags & UPDATEFLAG_NEW_DESTINATION) - { - flags |= MOVING_DESTINATION; - } - } - else - { - // No need to synchronize on the very last step. - flags |= MOVING_DESTINATION; } // Send move messages. @@ -331,14 +315,10 @@ static void informPlayer(MapComposite *map, Character *p) moveMsg.writeByte(flags); if (flags & MOVING_POSITION) { - moveMsg.writeCoordinates(opos.x / 32, opos.y / 32); + moveMsg.writeShort(opos.x); + moveMsg.writeShort(opos.y); moveMsg.writeByte(o->getSpeed() / 10); } - if (flags & MOVING_DESTINATION) - { - moveMsg.writeShort(odst.x); - moveMsg.writeShort(odst.y); - } } // Do not send a packet if nothing happened in p's range. |