diff options
author | David Athay <ko2fan@gmail.com> | 2009-04-21 12:55:20 +0100 |
---|---|---|
committer | David Athay <ko2fan@gmail.com> | 2009-04-21 12:55:20 +0100 |
commit | 18bb2946b4acfe8d3ac9184a453898718488e556 (patch) | |
tree | 1fab120d88839ab1e453af9b2cd9128145ff5824 /src | |
parent | 9f43e32022ac261c6475fc68832cbe9ba9645362 (diff) | |
download | mana-client-18bb2946b4acfe8d3ac9184a453898718488e556.tar.gz mana-client-18bb2946b4acfe8d3ac9184a453898718488e556.tar.bz2 mana-client-18bb2946b4acfe8d3ac9184a453898718488e556.tar.xz mana-client-18bb2946b4acfe8d3ac9184a453898718488e556.zip |
Fix hang on exit
Diffstat (limited to 'src')
-rw-r--r-- | src/main.cpp | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/src/main.cpp b/src/main.cpp index 5c9d1726..b6635be0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -961,11 +961,8 @@ int main(int argc, char *argv[]) unsigned int oldstate = !state; // We start with a status change. SDL_Event event; -#ifdef TMWSERV_SUPPORT - while (state != STATE_FORCE_QUIT) -#else + while (state != STATE_EXIT) -#endif { // Handle SDL events while (SDL_PollEvent(&event)) @@ -973,11 +970,7 @@ int main(int argc, char *argv[]) switch (event.type) { case SDL_QUIT: -#ifdef TMWSERV_SUPPORT - state = STATE_FORCE_QUIT; -#else state = STATE_EXIT; -#endif break; case SDL_KEYDOWN: @@ -1283,11 +1276,11 @@ int main(int argc, char *argv[]) game->logic(); delete game; - // If the quitdialog didn't set the next state - if (state == STATE_GAME) - { - state = STATE_EXIT; - } + state = STATE_EXIT; + + logoutThenExit(); + Net::getGeneralHandler()->unload(); + break; case STATE_SWITCH_CHARACTER: @@ -1310,12 +1303,6 @@ int main(int argc, char *argv[]) case STATE_WAIT: break; - case STATE_EXIT: - logger->log("State: EXIT"); - logoutThenExit(); - Net::getGeneralHandler()->unload(); - break; - default: state = STATE_FORCE_QUIT; break; |