QTfrontend/hwform.cpp
changeset 4430 cacda05a053e
parent 4429 f9a949ef955b
child 4431 a5827e0e5e0b
--- a/QTfrontend/hwform.cpp	Sun Nov 28 13:12:00 2010 -0500
+++ b/QTfrontend/hwform.cpp	Sun Nov 28 13:58:25 2010 -0500
@@ -513,6 +513,7 @@
 // joining the lobby 
     else if(id == ID_PAGE_ROOMSLIST) {
         if ( hwnet && game && game->gameState == gsStarted) { // abnormal exit - kick or room destruction - send kills.
+            game->netSuspend = true;
             game->KillAllTeams();
         }
         ui.pageRoomsList->chatWidget->loadLists(ui.pageOptions->editNetNick->text());
@@ -938,6 +939,7 @@
 
 void HWForm::GameStateChanged(GameState gameState)
 {
+    quint8 id = ui.Pages->currentIndex();
     switch(gameState) {
         case gsStarted: {
             Music(false);
@@ -956,11 +958,12 @@
         case gsFinished: {
             //setVisible(true);
             setFocusPolicy(Qt::StrongFocus);
-            if (!hwnet || (!hwnet->isRoomChief() || !hwnet->isInRoom())) GoBack();
+            if (id == ID_PAGE_INGAME) GoBack();
             Music(ui.pageOptions->CBEnableFrontendMusic->isChecked());
             if (wBackground) wBackground->startAnimation();
             GoToPage(ID_PAGE_GAMESTATS);
-            if (hwnet) hwnet->gameFinished();
+            if (hwnet && (!game || !game->netSuspend)) hwnet->gameFinished();
+            if (game) game->netSuspend = false;
             break;
         }
         default: {
@@ -971,7 +974,7 @@
 // was room chief and the game was aborted
                 (hwnet && hwnet->isRoomChief() && hwnet->isInRoom() && 
                     (gameState == gsInterrupted || gameState == gsStopped || gameState == gsDestroyed))) {
-                if (!hwnet || (!hwnet->isRoomChief() || !hwnet->isInRoom())) GoBack();
+                if (id == ID_PAGE_INGAME) GoBack();
                 Music(ui.pageOptions->CBEnableFrontendMusic->isChecked());
                 if (wBackground) wBackground->startAnimation();
                 if (hwnet) hwnet->gameFinished();