Try suppressing those annoying "incorrect state" messages without actually breaking net play. Alter prior checks on GoBack. NEEDS TESTING.
authornemo
Sun, 28 Nov 2010 13:58:25 -0500
changeset 4430 cacda05a053e
parent 4429 f9a949ef955b
child 4431 a5827e0e5e0b
Try suppressing those annoying "incorrect state" messages without actually breaking net play. Alter prior checks on GoBack. NEEDS TESTING.
QTfrontend/game.cpp
QTfrontend/game.h
QTfrontend/hwform.cpp
--- a/QTfrontend/game.cpp	Sun Nov 28 13:12:00 2010 -0500
+++ b/QTfrontend/game.cpp	Sun Nov 28 13:58:25 2010 -0500
@@ -40,6 +40,7 @@
     this->config = config;
     this->gamecfg = gamecfg;
     TeamCount = 0;
+    netSuspend = false;
 }
 
 HWGame::~HWGame()
@@ -245,7 +246,7 @@
             break;
         }
         default: {
-            if (gameType == gtNet)
+            if (gameType == gtNet && !netSuspend)
             {
                 emit SendNet(msg);
             }
--- a/QTfrontend/game.h	Sun Nov 28 13:12:00 2010 -0500
+++ b/QTfrontend/game.h	Sun Nov 28 13:58:25 2010 -0500
@@ -55,6 +55,7 @@
     void StartCampaign(const QString & file);
     void KillAllTeams();
     GameState gameState;
+    bool netSuspend;
 
  protected:
     virtual QStringList setArguments();
--- 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();