[Orxonox-commit 2828] r7531 - code/trunk/src/modules/pickup

dafrick at orxonox.net dafrick at orxonox.net
Tue Oct 12 20:33:58 CEST 2010


Author: dafrick
Date: 2010-10-12 20:33:58 +0200 (Tue, 12 Oct 2010)
New Revision: 7531

Modified:
   code/trunk/src/modules/pickup/PickupManager.cc
Log:
Fixing bug, that caused segfault in pickups with multiplayer.


Modified: code/trunk/src/modules/pickup/PickupManager.cc
===================================================================
--- code/trunk/src/modules/pickup/PickupManager.cc	2010-10-12 16:02:07 UTC (rev 7530)
+++ code/trunk/src/modules/pickup/PickupManager.cc	2010-10-12 18:33:58 UTC (rev 7531)
@@ -403,11 +403,21 @@
 
         if(GameMode::isStandalone() || Host::getPlayerID() == clientId)
         {
-            PickupManager::pickupChangedPickedUpNetwork(index, pickup->isUsable(), this->representations_[pickup->getPickupIdentifier()]->getObjectID(), pickedUp);
+            if(this->representations_.find(pickup->getPickupIdentifier()) == this->representations_.end())
+                PickupManager::pickupChangedPickedUpNetwork(index, pickup->isUsable(), this->defaultRepresentation_->getObjectID(), pickedUp);
+            else
+                PickupManager::pickupChangedPickedUpNetwork(index, pickup->isUsable(), this->representations_[pickup->getPickupIdentifier()]->getObjectID(), pickedUp);
         }
         else
         {
-            callStaticNetworkFunction(PickupManager::pickupChangedPickedUpNetwork, clientId, index, pickup->isUsable(), this->representations_[pickup->getPickupIdentifier()]->getObjectID(), pickedUp);
+            if(this->representations_.find(pickup->getPickupIdentifier()) == this->representations_.end())
+            {
+                callStaticNetworkFunction(PickupManager::pickupChangedPickedUpNetwork, clientId, index, pickup->isUsable(), this->defaultRepresentation_->getObjectID(), pickedUp);
+            }
+            else
+            {
+                callStaticNetworkFunction(PickupManager::pickupChangedPickedUpNetwork, clientId, index, pickup->isUsable(), this->representations_[pickup->getPickupIdentifier()]->getObjectID(), pickedUp);
+            }
         }
 
     }




More information about the Orxonox-commit mailing list