diff options
author | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2006-08-06 17:30:40 +0000 |
---|---|---|
committer | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2006-08-06 17:30:40 +0000 |
commit | 4c15d1d1dcedb3627e501fb5ddba4ae74281968c (patch) | |
tree | de4a44e603d05742b4eaffff75b759e1ac6ff85c /src/gamehandler.cpp | |
parent | ce849af300a70425b574b724c62dc9f5fce6016b (diff) | |
download | manaserv-4c15d1d1dcedb3627e501fb5ddba4ae74281968c.tar.gz manaserv-4c15d1d1dcedb3627e501fb5ddba4ae74281968c.tar.bz2 manaserv-4c15d1d1dcedb3627e501fb5ddba4ae74281968c.tar.xz manaserv-4c15d1d1dcedb3627e501fb5ddba4ae74281968c.zip |
Implemented crude handling of being movements.
Diffstat (limited to 'src/gamehandler.cpp')
-rw-r--r-- | src/gamehandler.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/gamehandler.cpp b/src/gamehandler.cpp index b3dfb324..6dfab787 100644 --- a/src/gamehandler.cpp +++ b/src/gamehandler.cpp @@ -27,6 +27,7 @@ #include <map> #include "gameclient.h" +#include "map.h" #include "messagein.h" #include "messageout.h" #include "netcomputer.h" @@ -194,12 +195,10 @@ void GameHandler::processMessage(NetComputer *comp, MessageIn &message) case PGMSG_WALK: { - long x = message.readLong(); - long y = message.readLong(); + unsigned x = message.readShort(); + unsigned y = message.readShort(); - // simplistic "teleport" walk - computer.getCharacter()->setX(x); - computer.getCharacter()->setY(y); + computer.getCharacter()->setDestination(x, y); // no response should be required } break; @@ -220,7 +219,7 @@ void GameHandler::processMessage(NetComputer *comp, MessageIn &message) break; } - if (result.getPacket()->length > 0) + if (result.getDataSize() > 0) computer.send(result.getPacket()); } @@ -248,10 +247,8 @@ void GameHandler::sayAround(GameClient &computer, std::string const &text) std::pair<unsigned, unsigned> listenerXY = listener->getXY(); - if (abs(listenerXY.first - speakerXY.first) <= - (int)AROUND_AREA_IN_TILES && - abs(listenerXY.second - speakerXY.second) <= - (int)AROUND_AREA_IN_TILES) + if (areAround(listenerXY.first, listenerXY.second, + speakerXY.first, speakerXY.second)) { (*i)->send(msg.getPacket()); } |