diff options
author | Stefan Dombrowski <stefan@uni-bonn.de> | 2011-03-30 00:37:05 +0200 |
---|---|---|
committer | Stefan Dombrowski <stefan@uni-bonn.de> | 2011-03-30 00:37:05 +0200 |
commit | 717ebd24d5419ad79ec215c2d28256268a3fa315 (patch) | |
tree | c7d802529bc12767c0e3583e70fda23dfc0311b7 /src/net/manaserv/charhandler.cpp | |
parent | 8279335d17b312a74492244cc4da3f212410ebd5 (diff) | |
download | mana-717ebd24d5419ad79ec215c2d28256268a3fa315.tar.gz mana-717ebd24d5419ad79ec215c2d28256268a3fa315.tar.bz2 mana-717ebd24d5419ad79ec215c2d28256268a3fa315.tar.xz mana-717ebd24d5419ad79ec215c2d28256268a3fa315.zip |
Fixing zombies in char select dialog
How to reproduce the bug:
* Delete a character.
* Create a new character in another slot.
* Now the deleted character reappears.
Also fixing handling of error messages from character select response.
This resolves http://bugs.manasource.org/view.php?id=322
Reviewed-by: Jaxad0127, VUT
Diffstat (limited to 'src/net/manaserv/charhandler.cpp')
-rw-r--r-- | src/net/manaserv/charhandler.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/net/manaserv/charhandler.cpp b/src/net/manaserv/charhandler.cpp index 961b364a..79f3b35a 100644 --- a/src/net/manaserv/charhandler.cpp +++ b/src/net/manaserv/charhandler.cpp @@ -196,6 +196,14 @@ void CharHandler::handleCharacterDeleteResponse(Net::MessageIn &msg) if (errMsg == ERRMSG_OK) { // Character deletion successful + for (unsigned i = 0; i < mCachedCharacterInfos.size(); ++i) + { + if (mCachedCharacterInfos[i].slot == mSelectedCharacter->slot) + { + mCachedCharacterInfos.erase(mCachedCharacterInfos.begin() + i); + break; + } + } delete mSelectedCharacter; mCharacters.remove(mSelectedCharacter); updateCharSelectDialog(); @@ -248,9 +256,20 @@ void CharHandler::handleCharacterSelectResponse(Net::MessageIn &msg) Client::setState(STATE_CONNECT_GAME); } - else if (errMsg == ERRMSG_FAILURE) + else { - errorMessage = _("No gameservers are available."); + switch (errMsg) + { + case ERRMSG_FAILURE: + errorMessage = _("No gameservers are available."); + break; + case ERRMSG_INVALID_ARGUMENT: + errorMessage = _("Invalid character slot selected."); + break; + default: + errorMessage = strprintf(_("Unhandled character select " + "error message %i."), errMsg); + } delete_all(mCharacters); mCharacters.clear(); Client::setState(STATE_ERROR); |