diff options
author | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2010-02-05 22:15:43 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2010-02-06 21:25:37 +0100 |
commit | 242e3bb8d92def67d5c30f2f2fd974cfb117ec04 (patch) | |
tree | 7f247e04e238a0edc0281ec8ed85539b2be81137 /src/net/manaserv/playerhandler.cpp | |
parent | 51e14c9d7aab75fe60f68d4943759eef66eafe9a (diff) | |
download | mana-client-242e3bb8d92def67d5c30f2f2fd974cfb117ec04.tar.gz mana-client-242e3bb8d92def67d5c30f2f2fd974cfb117ec04.tar.bz2 mana-client-242e3bb8d92def67d5c30f2f2fd974cfb117ec04.tar.xz mana-client-242e3bb8d92def67d5c30f2f2fd974cfb117ec04.zip |
Merged the Engine class into the Game class
There was little point in keeping the Engine class separate. It wasn't
an engine at all, but only kept track of the currently active map, a job
more suitable for the Game class anyway.
Diffstat (limited to 'src/net/manaserv/playerhandler.cpp')
-rw-r--r-- | src/net/manaserv/playerhandler.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/net/manaserv/playerhandler.cpp b/src/net/manaserv/playerhandler.cpp index 9225b765..624a442a 100644 --- a/src/net/manaserv/playerhandler.cpp +++ b/src/net/manaserv/playerhandler.cpp @@ -23,7 +23,7 @@ #include "net/manaserv/beinghandler.h" #include "effectmanager.h" -#include "engine.h" +#include "game.h" #include "localplayer.h" #include "log.h" #include "particle.h" @@ -304,12 +304,14 @@ void PlayerHandler::handleMapChangeMessage(Net::MessageIn &msg) const std::string mapName = msg.readString(); const unsigned short x = msg.readInt16(); const unsigned short y = msg.readInt16(); - const bool nearby = (engine->getCurrentMapName() == mapName); + + Game *game = Game::instance(); + const bool sameMap = (game->getCurrentMapName() == mapName); logger->log("Changing map to %s (%d, %d)", mapName.c_str(), x, y); // Switch the actual map, deleting the previous one - engine->changeMap(mapName); + game->changeMap(mapName); current_npc = 0; @@ -318,7 +320,7 @@ void PlayerHandler::handleMapChangeMessage(Net::MessageIn &msg) float scrollOffsetY = 0.0f; /* Scroll if neccessary */ - if (!nearby + if (!sameMap || (abs(x - (int) playerPos.x) > MAP_TELEPORT_SCROLL_DISTANCE) || (abs(y - (int) playerPos.y) > MAP_TELEPORT_SCROLL_DISTANCE)) { |