diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-03-07 17:46:31 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-03-07 17:46:31 +0300 |
commit | a80e10b7ba9771dca3fcddb3f0182a5aa1825226 (patch) | |
tree | 85f7ad40f3bc0d030e2dab57cb2af65dfa04cf33 | |
parent | f8fcfcfef1e5a8cbda66328664f41b3f9aa2a773 (diff) | |
download | mv-a80e10b7ba9771dca3fcddb3f0182a5aa1825226.tar.gz mv-a80e10b7ba9771dca3fcddb3f0182a5aa1825226.tar.bz2 mv-a80e10b7ba9771dca3fcddb3f0182a5aa1825226.tar.xz mv-a80e10b7ba9771dca3fcddb3f0182a5aa1825226.zip |
Fix server switch incorrect map loading.
-rw-r--r-- | src/client.cpp | 1 | ||||
-rw-r--r-- | src/net/ea/gamehandler.cpp | 8 | ||||
-rw-r--r-- | src/net/ea/gamehandler.h | 2 | ||||
-rw-r--r-- | src/net/eathena/gamehandler.h | 2 | ||||
-rw-r--r-- | src/net/gamehandler.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/gamehandler.h | 2 |
6 files changed, 12 insertions, 5 deletions
diff --git a/src/client.cpp b/src/client.cpp index ef4c2fd53..9346a30b6 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -1619,6 +1619,7 @@ int Client::gameExec() Net::getLoginHandler()->disconnect(); Net::getGameHandler()->disconnect(); + Net::getGameHandler()->clear(); mState = STATE_CHOOSE_SERVER; BLOCK_END("Client::gameExec STATE_SWITCH_SERVER") diff --git a/src/net/ea/gamehandler.cpp b/src/net/ea/gamehandler.cpp index 3e9e36541..eaed1ec5d 100644 --- a/src/net/ea/gamehandler.cpp +++ b/src/net/ea/gamehandler.cpp @@ -48,7 +48,7 @@ void GameHandler::processEvent(Channels channel, { if (event.getName() == EVENT_ENGINESINITALIZED) { - if (mMap != "") + if (!mMap.empty()) Game::instance()->changeMap(mMap); } else if (event.getName() == EVENT_MAPLOADED) @@ -99,4 +99,10 @@ void GameHandler::processMapQuitResponse(Net::MessageIn &msg) new OkDialog(_("Game"), _("Request to quit denied!"), DIALOG_ERROR); } +void GameHandler::clear() +{ + mMap.clear(); + mCharID = 0; +} + } // namespace Ea diff --git a/src/net/ea/gamehandler.h b/src/net/ea/gamehandler.h index 93773e33d..c0b4286ce 100644 --- a/src/net/ea/gamehandler.h +++ b/src/net/ea/gamehandler.h @@ -62,6 +62,8 @@ class GameHandler : public Net::GameHandler, public Listener virtual void processMapQuitResponse(Net::MessageIn &msg); + virtual void clear(); + protected: std::string mMap; int mCharID; /// < Saved for map-server switching diff --git a/src/net/eathena/gamehandler.h b/src/net/eathena/gamehandler.h index d9b9d80f6..425285f91 100644 --- a/src/net/eathena/gamehandler.h +++ b/src/net/eathena/gamehandler.h @@ -52,8 +52,6 @@ class GameHandler final : public MessageHandler, public Ea::GameHandler void ping(int tick); - void clear(); - void disconnect2(); void mapLoadedEvent(); diff --git a/src/net/gamehandler.h b/src/net/gamehandler.h index 5a41bec57..5826ae09d 100644 --- a/src/net/gamehandler.h +++ b/src/net/gamehandler.h @@ -58,6 +58,8 @@ class GameHandler virtual bool canUseMagicBar() const A_WARN_UNUSED = 0; virtual bool mustPing() const A_WARN_UNUSED = 0; + + virtual void clear() = 0; }; } // namespace Net diff --git a/src/net/tmwa/gamehandler.h b/src/net/tmwa/gamehandler.h index b12876dd4..5ce70fbca 100644 --- a/src/net/tmwa/gamehandler.h +++ b/src/net/tmwa/gamehandler.h @@ -52,8 +52,6 @@ class GameHandler final : public MessageHandler, public Ea::GameHandler void ping(int tick); - void clear(); - void disconnect2(); void mapLoadedEvent(); |