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/game-server/state.cpp | |
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/game-server/state.cpp')
-rw-r--r-- | src/game-server/state.cpp | 30 |
1 files changed, 5 insertions, 25 deletions
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. |