[Orxonox-commit 5168] r9833 - code/trunk/src/modules/tetris

jo at orxonox.net jo at orxonox.net
Sun Dec 1 23:38:21 CET 2013


Author: jo
Date: 2013-12-01 23:38:21 +0100 (Sun, 01 Dec 2013)
New Revision: 9833

Modified:
   code/trunk/src/modules/tetris/Tetris.cc
   code/trunk/src/modules/tetris/Tetris.h
Log:
Fixing cleanup bug, that causes orxonox to crash when tetris was quitted before calling Tetris::end() and thus missing the cleanup process.

Modified: code/trunk/src/modules/tetris/Tetris.cc
===================================================================
--- code/trunk/src/modules/tetris/Tetris.cc	2013-12-01 13:52:08 UTC (rev 9832)
+++ code/trunk/src/modules/tetris/Tetris.cc	2013-12-01 22:38:21 UTC (rev 9833)
@@ -344,6 +344,16 @@
             if (it->first->isHumanPlayer() && (it->first->isReadyToSpawn() || this->bForceSpawn_))
                 this->spawnPlayer(it->first);
     }
+    
+    bool Tetris::playerLeft(PlayerInfo* player)
+    {
+        bool left = Gametype::playerLeft(player);
+        if(player && player->isHumanPlayer())
+        {
+            this->end();
+        }
+        return left;
+    }
 
     /**
     @brief

Modified: code/trunk/src/modules/tetris/Tetris.h
===================================================================
--- code/trunk/src/modules/tetris/Tetris.h	2013-12-01 13:52:08 UTC (rev 9832)
+++ code/trunk/src/modules/tetris/Tetris.h	2013-12-01 22:38:21 UTC (rev 9833)
@@ -63,6 +63,7 @@
             virtual void tick(float dt);
 
             virtual void spawnPlayer(PlayerInfo* player); //!< Spawns the input player.
+            virtual bool playerLeft(PlayerInfo* player);
 
             void setCenterpoint(TetrisCenterpoint* center);
 




More information about the Orxonox-commit mailing list