summaryrefslogtreecommitdiff
path: root/src/net/manaserv/gamehandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/manaserv/gamehandler.cpp')
-rw-r--r--src/net/manaserv/gamehandler.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/net/manaserv/gamehandler.cpp b/src/net/manaserv/gamehandler.cpp
index 271fff15..5e29a896 100644
--- a/src/net/manaserv/gamehandler.cpp
+++ b/src/net/manaserv/gamehandler.cpp
@@ -94,7 +94,10 @@ void GameHandler::handleMessage(Net::MessageIn &msg)
void GameHandler::connect()
{
gameServerConnection->connect(gameServer.hostname, gameServer.port);
- chatServerConnection->connect(chatServer.hostname, chatServer.port);
+
+ // Will already be connected if we just changed gameservers
+ if (!chatServerConnection->isConnected())
+ chatServerConnection->connect(chatServer.hostname, chatServer.port);
}
bool GameHandler::isConnected()
@@ -106,7 +109,10 @@ bool GameHandler::isConnected()
void GameHandler::disconnect()
{
gameServerConnection->disconnect();
- chatHandler->disconnect();
+
+ // No need if we're just changing gameservers
+ if (Client::getState() != STATE_CHANGE_MAP)
+ chatHandler->disconnect();
}
void GameHandler::inGame()