summaryrefslogtreecommitdiff
path: root/src/net/manaserv/charhandler.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2010-04-12 21:52:27 -0600
committerJared Adams <jaxad0127@gmail.com>2010-04-16 17:43:52 -0600
commitcf4a1da4eaffe19090a2246e0d3111b885a64ace (patch)
tree6187c8c7a91796e485c71ea7c88c819bec902b66 /src/net/manaserv/charhandler.cpp
parent11a6f342e579c26320334b9ae9735701386e3b25 (diff)
downloadmana-cf4a1da4eaffe19090a2246e0d3111b885a64ace.tar.gz
mana-cf4a1da4eaffe19090a2246e0d3111b885a64ace.tar.bz2
mana-cf4a1da4eaffe19090a2246e0d3111b885a64ace.tar.xz
mana-cf4a1da4eaffe19090a2246e0d3111b885a64ace.zip
Fix canceling game connection
Reviewed-by: Bertram
Diffstat (limited to 'src/net/manaserv/charhandler.cpp')
-rw-r--r--src/net/manaserv/charhandler.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/net/manaserv/charhandler.cpp b/src/net/manaserv/charhandler.cpp
index 4b574821..c070ab23 100644
--- a/src/net/manaserv/charhandler.cpp
+++ b/src/net/manaserv/charhandler.cpp
@@ -68,6 +68,11 @@ CharHandler::CharHandler()
charHandler = this;
}
+CharHandler::~CharHandler()
+{
+ clear();
+}
+
void CharHandler::handleMessage(Net::MessageIn &msg)
{
switch (msg.getId())
@@ -225,16 +230,10 @@ void CharHandler::handleCharacterSelectResponse(Net::MessageIn &msg)
logger->log("Chat server: %s:%d", chatServer.hostname.c_str(),
chatServer.port);
- gameServerConnection->connect(gameServer.hostname, gameServer.port);
- chatServerConnection->connect(chatServer.hostname, chatServer.port);
-
// Prevent the selected local player from being deleted
player_node = mSelectedCharacter->dummy;
mSelectedCharacter->dummy = 0;
- mCachedCharacterInfos.clear();
- updateCharacters();
-
Client::setState(STATE_CONNECT_GAME);
}
else if (errMsg == ERRMSG_FAILURE)
@@ -381,4 +380,13 @@ void CharHandler::updateCharacters()
updateCharSelectDialog();
}
+void CharHandler::clear()
+{
+ setCharCreateDialog(0);
+ setCharSelectDialog(0);
+
+ mCachedCharacterInfos.clear();
+ updateCharacters();
+}
+
} // namespace ManaServ