From 94bfab1a7d1ac3626d15c30b8c6668de9455f3ed Mon Sep 17 00:00:00 2001 From: BlueSansDouze Date: Wed, 13 Jan 2010 13:45:27 +0100 Subject: 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 --- src/net/ea/beinghandler.cpp | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'src/net/ea/beinghandler.cpp') 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 { -- cgit v1.2.3-70-g09d2