Menu no longer crashes randomly
authorHeli Hyvättinen <heli.hyvattinen@kymp.net>
Mon, 25 Jul 2011 13:26:20 +0000 (16:26 +0300)
committerHeli Hyvättinen <heli.hyvattinen@kymp.net>
Mon, 25 Jul 2011 13:26:20 +0000 (16:26 +0300)
Moved the unpausing to be handled by each menu item themselves. Now
unpauses only after restart game and restart level.
Mysterios crashes caused by the former unpause if condition thus gone.

seascene.cpp

index aa5f91f..d714baf 100644 (file)
@@ -407,17 +407,27 @@ void SeaScene::handleScreenTapped()
     QGraphicsItem* pItem = items.at(0); //Selecting an item brings here, thus only selecting one item should be possible
                                        //... so we can just take the first one
 
+    //Selection is just used to get notice of a menu item being clicked, removed after use
+
+    clearSelection();
+
+
+    //Act upon the selected item
+
 
     if (pItem == pRestartGameItem_)
     {
         qDebug() << "game restart requested";
         restartGame();
+        pPauseAction_->setChecked(false); //unpause game
+
     }
 
     else if (pItem == pRestartLevelItem_)
     {
         qDebug() << "Level restart requested";
         restartLevel();
+        pPauseAction_->setChecked(false); //unpause game
 
     }
 
@@ -450,20 +460,6 @@ void SeaScene::handleScreenTapped()
     {
         qApp->quit();
     }
-
-
-
-    //Selection is just used to get notice of a menu item being clicked, removed after use
-
-    clearSelection();
-
-    //The user propably went to paused state just to access menu, so unpause unless vibration set (so the user sees its changed)
-    //or unless status bar was requested
-    if (pItem != pMinimizeItem_ || pItem != pSettingsItem_)
-
-    {
-        pPauseAction_->setChecked(false);
-    }
 }