diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2008-08-28 18:32:11 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2008-08-28 18:32:11 +0000 |
commit | 566a6fb8d0fc35267b43721f7e1802ba3475af3d (patch) | |
tree | f5d3e09bda9e8e66be885b581f28cad4130ca645 /src/net/playerhandler.cpp | |
parent | b506fe0ff8a2039167aa7c349087af4dd03e1921 (diff) | |
download | mana-client-566a6fb8d0fc35267b43721f7e1802ba3475af3d.tar.gz mana-client-566a6fb8d0fc35267b43721f7e1802ba3475af3d.tar.bz2 mana-client-566a6fb8d0fc35267b43721f7e1802ba3475af3d.tar.xz mana-client-566a6fb8d0fc35267b43721f7e1802ba3475af3d.zip |
Added support for being effects through the eAthena levelup message, and check
whether the being exists before referencing it. Re-enabled proper MP bar
display. Improved handling of a warp to the same map.
Diffstat (limited to 'src/net/playerhandler.cpp')
-rw-r--r-- | src/net/playerhandler.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/net/playerhandler.cpp b/src/net/playerhandler.cpp index 463868db..27d4e601 100644 --- a/src/net/playerhandler.cpp +++ b/src/net/playerhandler.cpp @@ -52,6 +52,9 @@ extern BuyDialog *buyDialog; extern SellDialog *sellDialog; extern Window *buySellDialog; +static const int MAP_TELEPORT_SCROLL_DISTANCE = 8; /* Max. distance we are willing to scroll after a teleport; + ** everything beyond will reset the port hard. */ + /** * Listener used for handling the overweigth message. */ @@ -118,6 +121,7 @@ void PlayerHandler::handleMessage(MessageIn *msg) case SMSG_PLAYER_WARP: { std::string mapPath = msg->readString(16); + bool nearby; Uint16 x = msg->readInt16(); Uint16 y = msg->readInt16(); @@ -129,13 +133,22 @@ void PlayerHandler::handleMessage(MessageIn *msg) */ player_node->stopAttack(); - // Switch the actual map, deleting the previous one + nearby = (engine->getCurrentMapName() == mapPath); + // Switch the actual map, deleting the previous one if necessary engine->changeMap(mapPath); current_npc = 0; - float scrollOffsetX = (x - player_node->mX) * 32; - float scrollOffsetY = (y - player_node->mY) * 32; + float scrollOffsetX = 0.0f; + float scrollOffsetY = 0.0f; + + /* Scroll if neccessary */ + if (!nearby + || (abs(x - player_node->mX) > MAP_TELEPORT_SCROLL_DISTANCE) + || (abs(y - player_node->mY) > MAP_TELEPORT_SCROLL_DISTANCE)) { + scrollOffsetX = (x - player_node->mX) * 32; + scrollOffsetY = (y - player_node->mY) * 32; + } player_node->setAction(Being::STAND); player_node->mFrame = 0; |