pingus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pingus-CVS] r3679 - trunk/pingus/src


From: grumbel at BerliOS
Subject: [Pingus-CVS] r3679 - trunk/pingus/src
Date: Sat, 5 Jul 2008 04:39:50 +0200

Author: grumbel
Date: 2008-07-05 04:39:50 +0200 (Sat, 05 Jul 2008)
New Revision: 3679

Modified:
   trunk/pingus/src/goal_manager.cpp
Log:
Fixed game not existing when escape is pressed while in pause

Modified: trunk/pingus/src/goal_manager.cpp
===================================================================
--- trunk/pingus/src/goal_manager.cpp   2008-07-05 02:36:28 UTC (rev 3678)
+++ trunk/pingus/src/goal_manager.cpp   2008-07-05 02:39:50 UTC (rev 3679)
@@ -30,27 +30,32 @@
 bool
 GoalManager::is_finished()
 {
-  if (goal == GT_NONE)
+  switch (goal)
     {
-      return false;
+      case GT_NONE:
+        return false;
+    
+      case GT_GAME_ABORTED:
+        return true;
+
+      case GT_OUT_OF_TIME:
+      case GT_NO_PINGUS_IN_WORLD:
+      case GT_ARMAGEDDON:
+        if (exit_time == 0)
+          {
+            // we are finished, now wait a few second so that everybody can
+            // see the particles, etc.
+            exit_time = server->get_time() + 125;
+            return false;
+          }
+        else
+          {
+            return (exit_time < server->get_time());
+          }
+
+      default:
+        assert(!"GoalManager: unknown goal state");
     }
-  else if (goal == GT_GAME_ABORTED)
-    {
-      return true;
-    }
-  else if (exit_time == 0)
-    {
-      // we are finished, now wait a few second so that everybody can
-      // see the particles, etc.
-      if (maintainer_mode)
-        std::cout << "XXXX goal reached: " << goal << std::endl;
-      exit_time = server->get_time() + 125;
-      return false;
-    }
-  else
-    {
-      return (exit_time < server->get_time());
-    }
 }
 
 void
@@ -82,11 +87,7 @@
 void
 GoalManager::set_abort_goal()
 {
-  if (exit_time == 0)
-    {
-      goal = GT_GAME_ABORTED;
-      exit_time = server->get_time();
-    }
+  goal = GT_GAME_ABORTED;
 }
 
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]