Changeset 10624 for code/trunk/src/modules/pickup/PickupManager.cc
- Timestamp:
- Oct 4, 2015, 9:12:21 PM (9 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
-
code/trunk/src/modules/pickup/PickupManager.cc
r9667 r10624 38 38 #include "core/GUIManager.h" 39 39 #include "core/class/Identifier.h" 40 #include "core/singleton/ScopedSingletonIncludes.h" 40 41 #include "network/Host.h" 41 #include "network/NetworkFunction.h" 42 #include "util/ScopedSingletonManager.h" 42 #include "network/NetworkFunctionIncludes.h" 43 43 44 44 #include "infos/PlayerInfo.h" … … 51 51 namespace orxonox 52 52 { 53 ManageScopedSingleton(PickupManager, ScopeID::R oot, false);53 ManageScopedSingleton(PickupManager, ScopeID::ROOT, false); 54 54 55 55 // Initialization of the name of the PickupInventory GUI. … … 62 62 registerStaticNetworkFunction(PickupManager::usePickupNetworked); 63 63 64 RegisterAbstractClass(PickupManager).inheritsFrom<PickupListener>(); 65 64 66 /** 65 67 @brief … … 94 96 95 97 // Destroying all the WeakPointers that are still there. 96 for(std::map<uint32_t, WeakPtr<Pickupable>*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)97 delete it->second;98 98 this->pickups_.clear(); 99 99 … … 212 212 else 213 213 { 214 callStaticNetworkFunction( PickupManager::pickupChangedUsedNetwork, clientId, index, used, pickup->isUsable(), pickup->isUnusable());214 callStaticNetworkFunction(&PickupManager::pickupChangedUsedNetwork, clientId, index, used, pickup->isUsable(), pickup->isUnusable()); 215 215 } 216 216 } … … 286 286 // Add the Pickupable to the indexes_ and pickups_ lists. 287 287 this->indexes_[pickup] = index; 288 this->pickups_[index] = new WeakPtr<Pickupable>(pickup);288 this->pickups_[index] = pickup; 289 289 } 290 290 else // If it was dropped, it is removed from the required lists. … … 294 294 index = it->second; 295 295 296 // Remove the Pickupable form the indexes_ and pickups_ list. 297 WeakPtr<Pickupable>* ptr = this->pickups_[index]; 296 // Remove the Pickupable from the indexes_ and pickups_ list. 298 297 this->indexes_.erase(it); 299 298 this->pickups_.erase(index); 300 delete ptr;301 299 } 302 300 … … 316 314 if(this->representations_.find(pickup->getRepresentationName()) == this->representations_.end()) 317 315 { 318 callStaticNetworkFunction( PickupManager::pickupChangedPickedUpNetwork, clientId, index, pickup->isUsable(), this->defaultRepresentation_->getObjectID(), pickedUp);316 callStaticNetworkFunction(&PickupManager::pickupChangedPickedUpNetwork, clientId, index, pickup->isUsable(), this->defaultRepresentation_->getObjectID(), pickedUp); 319 317 } 320 318 else 321 319 { 322 callStaticNetworkFunction( PickupManager::pickupChangedPickedUpNetwork, clientId, index, pickup->isUsable(), this->representations_[pickup->getRepresentationName()]->getObjectID(), pickedUp);320 callStaticNetworkFunction(&PickupManager::pickupChangedPickedUpNetwork, clientId, index, pickup->isUsable(), this->representations_[pickup->getRepresentationName()]->getObjectID(), pickedUp); 323 321 } 324 322 } … … 400 398 if(this->pickups_.empty()) 401 399 return; 402 Pickupable* pickupable = this->pickups_.find(pickup)->second ->get();400 Pickupable* pickupable = this->pickups_.find(pickup)->second; 403 401 if(pickupable != NULL) 404 402 pickupable->drop(); … … 407 405 else 408 406 { 409 callStaticNetworkFunction( PickupManager::dropPickupNetworked, 0, pickup);407 callStaticNetworkFunction(&PickupManager::dropPickupNetworked, 0, pickup); 410 408 } 411 409 } … … 443 441 if(this->pickups_.empty()) 444 442 return; 445 Pickupable* pickupable = this->pickups_.find(pickup)->second ->get();443 Pickupable* pickupable = this->pickups_.find(pickup)->second; 446 444 if(pickupable != NULL) 447 445 pickupable->setUsed(use); … … 450 448 else 451 449 { 452 callStaticNetworkFunction( PickupManager::usePickupNetworked, 0, pickup, use);450 callStaticNetworkFunction(&PickupManager::usePickupNetworked, 0, pickup, use); 453 451 } 454 452 }
Note: See TracChangeset
for help on using the changeset viewer.