diff options
author | BlueSansDouze <bluesansdouze@gmail.com> | 2010-01-13 13:45:27 +0100 |
---|---|---|
committer | BlueSansDouze <bluesansdouze@gmail.com> | 2010-01-13 14:22:44 +0100 |
commit | 94bfab1a7d1ac3626d15c30b8c6668de9455f3ed (patch) | |
tree | e569de48e7553e86d2abf0822c2646c4b1c1f95a /src/net | |
parent | 61959f6a04c6a6712b5334ebd6bf21da4736431f (diff) | |
download | mana-94bfab1a7d1ac3626d15c30b8c6668de9455f3ed.tar.gz mana-94bfab1a7d1ac3626d15c30b8c6668de9455f3ed.tar.bz2 mana-94bfab1a7d1ac3626d15c30b8c6668de9455f3ed.tar.xz mana-94bfab1a7d1ac3626d15c30b8c6668de9455f3ed.zip |
Adds a follow manager for users
Right click contextual menu on player "follow" entry
Cancel the following by moving with mouse or keys
Adds a special behavior for map changes
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/ea/beinghandler.cpp | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp index 932f88d9..45e58dee 100644 --- a/src/net/ea/beinghandler.cpp +++ b/src/net/ea/beinghandler.cpp @@ -111,7 +111,8 @@ void BeingHandler::handleMessage(Net::MessageIn &msg) Being *srcBeing, *dstBeing; Player *player; int hairStyle, hairColor, flag; - + std::string player_followed; + switch (msg.getId()) { case SMSG_BEING_VISIBLE: @@ -218,7 +219,7 @@ void BeingHandler::handleMessage(Net::MessageIn &msg) dstBeing->setDirection(dir); } - msg.readInt8(); // unknown +// msg.readInt8(); // unknown msg.readInt8(); // unknown msg.readInt8(); // unknown / sit @@ -262,6 +263,16 @@ void BeingHandler::handleMessage(Net::MessageIn &msg) if (!dstBeing) break; + + player_followed = player_node->getFollow(); + + if (!player_followed.empty()) + { + if (dstBeing->getName() == player_followed) + { + player_node->setDestination(player_node->getNextDestX(), player_node->getNextDestY()); + } + } // If this is player's current target, clear it. if (dstBeing == player_node->getTarget()) @@ -554,6 +565,16 @@ void BeingHandler::handleMessage(Net::MessageIn &msg) msg.readCoordinatePair(srcX, srcY, dstX, dstY); dstBeing->setTileCoords(srcX, srcY); dstBeing->setDestination(dstX, dstY); + + player_followed = player_node->getFollow(); + if (!player_followed.empty()) + { + if (dstBeing->getName() == player_followed) + { + player_node->setNextDest(dstX, dstY); + player_node->setDestination(srcX, srcY); + } + } } else { |