[Orxonox-commit 1248] r5966 - in code/trunk/src/orxonox: . gamestates

scheusso at orxonox.net scheusso at orxonox.net
Mon Oct 19 20:25:30 CEST 2009


Author: scheusso
Date: 2009-10-19 20:25:30 +0200 (Mon, 19 Oct 2009)
New Revision: 5966

Modified:
   code/trunk/src/orxonox/PlayerManager.cc
   code/trunk/src/orxonox/PlayerManager.h
   code/trunk/src/orxonox/gamestates/GSLevel.cc
Log:
(kind of) fixed HumanPlayer bodys beeing around from clients that have not yet disconnected when unloading level


Modified: code/trunk/src/orxonox/PlayerManager.cc
===================================================================
--- code/trunk/src/orxonox/PlayerManager.cc	2009-10-19 15:42:10 UTC (rev 5965)
+++ code/trunk/src/orxonox/PlayerManager.cc	2009-10-19 18:25:30 UTC (rev 5966)
@@ -90,6 +90,12 @@
                 player->destroy();
         }
     }
+    
+    void PlayerManager::disconnectAllClients()
+    {
+        for( std::map<unsigned int, PlayerInfo*>::iterator it = this->clients_.begin(); it != this->clients_.end(); )
+            this->clientDisconnected( (it++)->first );
+    }
 
 
     PlayerInfo* PlayerManager::getClient(unsigned int clientID) const

Modified: code/trunk/src/orxonox/PlayerManager.h
===================================================================
--- code/trunk/src/orxonox/PlayerManager.h	2009-10-19 15:42:10 UTC (rev 5965)
+++ code/trunk/src/orxonox/PlayerManager.h	2009-10-19 18:25:30 UTC (rev 5966)
@@ -51,6 +51,7 @@
 
             void clientConnected(unsigned int clientID);
             void clientDisconnected(unsigned int clientID);
+            void disconnectAllClients();
 
         private:
             std::map<unsigned int, PlayerInfo*> clients_;

Modified: code/trunk/src/orxonox/gamestates/GSLevel.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSLevel.cc	2009-10-19 15:42:10 UTC (rev 5965)
+++ code/trunk/src/orxonox/gamestates/GSLevel.cc	2009-10-19 18:25:30 UTC (rev 5966)
@@ -116,14 +116,14 @@
     {
         if (GameMode::showsGraphics())
         {
-            // disconnect the HumanPlayer
-            PlayerManager::getInstance().clientDisconnected(0);
-            
             // unload all compositors (this is only necessary because we don't yet destroy all resources!)
             Ogre::CompositorManager::getSingleton().removeAll();
 
             InputManager::getInstance().leaveState("game");
         }
+        
+        // disconnect all HumanPlayers
+        PlayerManager::getInstance().disconnectAllClients();
 
         if (GameMode::isMaster())
             this->unloadLevel();




More information about the Orxonox-commit mailing list