[Orxonox-commit 3196] r7889 - in code/trunk/src/orxonox/worldentities: . pawns

landauf at orxonox.net landauf at orxonox.net
Mon Feb 14 20:24:00 CET 2011


Author: landauf
Date: 2011-02-14 20:24:00 +0100 (Mon, 14 Feb 2011)
New Revision: 7889

Modified:
   code/trunk/src/orxonox/worldentities/ControllableEntity.cc
   code/trunk/src/orxonox/worldentities/ControllableEntity.h
   code/trunk/src/orxonox/worldentities/pawns/Pawn.cc
   code/trunk/src/orxonox/worldentities/pawns/Pawn.h
Log:
hack-fix: overridden implementations of stopLocalHumanControl() were not called in multiplayer, which caused the "fire" command to not reset in Spectator

Modified: code/trunk/src/orxonox/worldentities/ControllableEntity.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/ControllableEntity.cc	2011-02-14 18:59:51 UTC (rev 7888)
+++ code/trunk/src/orxonox/worldentities/ControllableEntity.cc	2011-02-14 19:24:00 UTC (rev 7889)
@@ -95,9 +95,6 @@
         {
             this->bDestroyWhenPlayerLeft_ = false;
 
-            if (this->bHasLocalController_ && this->bHasHumanController_)
-                this->stopLocalHumanControl();
-
             if (this->getPlayer() && this->getPlayer()->getControllableEntity() == this)
                 this->getPlayer()->stopControl();
 
@@ -134,6 +131,13 @@
         SetConfigValue(mouseLookSpeed_, 3.0f);
     }
 
+    void ControllableEntity::preDestroy()
+    {
+        // HACK - solve this clean and without preDestroy hook for multiplayer where removePlayer() isn't called
+        if (this->bHasLocalController_ && this->bHasHumanController_)
+            this->stopLocalHumanControl();
+    }
+
     void ControllableEntity::addCameraPosition(CameraPosition* position)
     {
         if (!position->getIsAbsolute())

Modified: code/trunk/src/orxonox/worldentities/ControllableEntity.h
===================================================================
--- code/trunk/src/orxonox/worldentities/ControllableEntity.h	2011-02-14 18:59:51 UTC (rev 7888)
+++ code/trunk/src/orxonox/worldentities/ControllableEntity.h	2011-02-14 19:24:00 UTC (rev 7889)
@@ -156,6 +156,8 @@
             void setTargetInternal( uint32_t targetID );
 
         protected:
+            virtual void preDestroy();
+
             virtual void setPlayer(PlayerInfo* player); // don't call this directly, use friend class PlayerInfo instead
             virtual void removePlayer();                // don't call this directly, use friend class PlayerInfo instead
 

Modified: code/trunk/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/Pawn.cc	2011-02-14 18:59:51 UTC (rev 7888)
+++ code/trunk/src/orxonox/worldentities/pawns/Pawn.cc	2011-02-14 19:24:00 UTC (rev 7889)
@@ -144,6 +144,13 @@
             }
     }
 
+    void Pawn::preDestroy()
+    {
+        // yay, multiple inheritance!
+        this->ControllableEntity::preDestroy();
+        this->PickupCarrier::preDestroy();
+    }
+
     void Pawn::setPlayer(PlayerInfo* player)
     {
         ControllableEntity::setPlayer(player);

Modified: code/trunk/src/orxonox/worldentities/pawns/Pawn.h
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/Pawn.h	2011-02-14 18:59:51 UTC (rev 7888)
+++ code/trunk/src/orxonox/worldentities/pawns/Pawn.h	2011-02-14 19:24:00 UTC (rev 7889)
@@ -131,6 +131,8 @@
                 { return this->getWorldPosition(); };
 
         protected:
+            virtual void preDestroy();
+
             virtual void setPlayer(PlayerInfo* player);
             virtual void removePlayer();
 




More information about the Orxonox-commit mailing list