Changeset 7162 for code/branches/presentation3/src/modules
- Timestamp:
- Aug 8, 2010, 8:53:52 PM (14 years ago)
- Location:
- code/branches/presentation3/src/modules/pickup
- Files:
-
- 2 added
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation3/src/modules/pickup/CMakeLists.txt
r7135 r7162 1 1 SET_SOURCE_FILES(PICKUP_SRC_FILES 2 CollectiblePickup.cc 2 3 DroppedPickup.cc 3 4 Pickup.cc -
code/branches/presentation3/src/modules/pickup/Pickup.cc
r7129 r7162 194 194 195 195 //! Sets the Pickup to used if the Pickup has activation type 'immediate' and gets picked up. 196 if(this-> getCarrier() != NULL && this->isPickedUp() && this->isImmediate())196 if(this->isPickedUp() && this->isImmediate()) 197 197 { 198 198 this->setUsed(true); -
code/branches/presentation3/src/modules/pickup/Pickup.h
r7129 r7162 40 40 #include "core/XMLPort.h" 41 41 42 #include " interfaces/Pickupable.h"42 #include "CollectiblePickup.h" 43 43 44 44 #include "tools/Timer.h" … … 74 74 Damian 'Mozork' Frick 75 75 */ 76 class _PickupExport Pickup : public Pickupable, public BaseObject76 class _PickupExport Pickup : public CollectiblePickup, public BaseObject 77 77 { 78 78 -
code/branches/presentation3/src/modules/pickup/PickupCollection.cc
r7127 r7162 35 35 #include "core/XMLPort.h" 36 36 #include "interfaces/PickupCarrier.h" 37 #include "CollectiblePickup.h" 37 38 #include "DroppedPickup.h" 38 39 #include "PickupCollectionIdentifier.h" … … 54 55 55 56 this->pickupCollectionIdentifier_ = new PickupCollectionIdentifier(this); 57 this->usedCounter_ = 0; 58 this->pickedUpCounter_ = 0; 59 this->disabledCounter_ = 0; 60 this->processingUsed_ = false; 61 this->processingPickedUp_ = false; 56 62 } 57 63 … … 62 68 PickupCollection::~PickupCollection() 63 69 { 64 //! Destroy all Pickupables constructing this PickupCollection. 65 for(std::vector<WeakPtr<Pickupable> >::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++) 66 { 67 if((*it).get() != NULL) 68 (*it).get()->destroy(); 69 } 70 // Destroy all Pickupables constructing this PickupCollection. 71 for(std::vector<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++) 72 { 73 (*it)->removeFromCollection(); 74 (*it)->destroy(); 75 } 76 this->pickups_.clear(); 70 77 } 71 78 … … 78 85 SUPER(PickupCollection, XMLPort, xmlelement, mode); 79 86 80 XMLPortObject(PickupCollection, Pickupable, "pickupables", addPickupable, getPickupable, xmlelement, mode);87 XMLPortObject(PickupCollection, CollectiblePickup, "pickupables", addPickupable, getPickupable, xmlelement, mode); 81 88 82 89 this->initializeIdentifier(); … … 89 96 void PickupCollection::initializeIdentifier(void) 90 97 { 91 for(std::vector< WeakPtr<Pickupable>>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)92 { 93 this->pickupCollectionIdentifier_->addPickup((*it) .get()->getPickupIdentifier());98 for(std::vector<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++) 99 { 100 this->pickupCollectionIdentifier_->addPickup((*it)->getPickupIdentifier()); 94 101 } 95 102 } … … 104 111 SUPER(PickupCollection, changedUsed); 105 112 106 //! Change used for all Pickupables this PickupCollection consists of. 107 for(std::vector<WeakPtr<Pickupable> >::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++) 108 { 109 (*it).get()->setUsed(this->isUsed()); 110 } 113 this->processingUsed_ = true; 114 // Change used for all Pickupables this PickupCollection consists of. 115 for(std::vector<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++) 116 { 117 (*it)->setUsed(this->isUsed()); 118 } 119 this->processingUsed_ = false; 120 121 this->changedUsedAction(); 122 } 123 124 /** 125 @brief 126 Helper method. 127 Checks whether due to changes in the used status of the pickups of this PickupCollection the used status of this PickupCollection has to change as well. 128 */ 129 void PickupCollection::changedUsedAction(void) 130 { 131 if(this->processingUsed_) 132 return; 133 134 // If all the pickups are not in use but the PickupCollection is. 135 if(this->usedCounter_ == 0 && this->isUsed()) 136 this->setUsed(false); 137 138 // If all the enabled pickups are in use but the PickupCollection is not. 139 if(this->usedCounter_ != 0 && this->usedCounter_ == this->pickups_.size()-this->disabledCounter_ && !this->isUsed()) 140 this->setUsed(true); 111 141 } 112 142 … … 120 150 SUPER(PickupCollection, changedCarrier); 121 151 122 //! Change the PickupCarrier for all Pickupables this PickupCollection consists of. 123 for(std::vector<WeakPtr<Pickupable> >::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++) 124 { 125 (*it).get()->setCarrier(this->getCarrier()->getTarget(*it), true); 152 // Change the PickupCarrier for all Pickupables this PickupCollection consists of. 153 for(std::vector<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++) 154 { 155 if(this->getCarrier() == NULL) 156 (*it)->setCarrier(NULL); 157 else 158 (*it)->setCarrier(this->getCarrier()->getTarget(*it)); 126 159 } 127 160 } … … 136 169 SUPER(PickupCollection, changedPickedUp); 137 170 138 //! Change the pickedUp status for all Pickupables this PickupCollection consists of. 139 for(std::vector<WeakPtr<Pickupable> >::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++) 140 { 141 (*it).get()->setPickedUp(this->isPickedUp()); 142 } 171 this->processingPickedUp_ = true; 172 // Change the pickedUp status for all Pickupables this PickupCollection consists of. 173 for(std::vector<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++) 174 { 175 (*it)->setPickedUp(this->isPickedUp()); 176 } 177 this->processingPickedUp_ = false; 178 179 this->changedPickedUpAction(); 180 } 181 182 /** 183 @brief 184 Helper method. 185 Checks whether due to changes in the picked up status of the pickups of this PickupCollection the picked up status of this PickupCollection has to change as well. 186 */ 187 void PickupCollection::changedPickedUpAction(void) 188 { 189 if(this->processingPickedUp_) 190 return; 191 192 // If at least all the enabled pickups of this PickupCollection are no longer picked up. 193 if(this->pickedUpCounter_ <= this->disabledCounter_ && this->isPickedUp()) 194 this->Pickupable::destroy(); 195 196 // If the PickupCollection is no longer picked up. 197 if(!this->isPickedUp()) 198 this->pickedUpCounter_ = 0; 143 199 } 144 200 … … 158 214 159 215 PickupCollection* pickup = dynamic_cast<PickupCollection*>(item); 160 //! Clone all Pickupables this PickupCollection consist of. 161 for(std::vector<WeakPtr<Pickupable> >::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++) 162 { 163 Pickupable* newPickup = (*it).get()->clone(); 164 pickup->addPickupable(newPickup); 216 // Clone all Pickupables this PickupCollection consist of. 217 for(std::vector<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++) 218 { 219 Pickupable* newPickup = (*it)->clone(); 220 CollectiblePickup* collectible = static_cast<CollectiblePickup*>(newPickup); 221 pickup->addPickupable(collectible); 165 222 } 166 223 … … 178 235 bool PickupCollection::isTarget(PickupCarrier* carrier) const 179 236 { 180 for(std::vector< WeakPtr<Pickupable>>::const_iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)181 { 182 if(!carrier->isTarget( (*it).get()))237 for(std::vector<CollectiblePickup*>::const_iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++) 238 { 239 if(!carrier->isTarget(*it)) 183 240 return false; 184 241 } … … 207 264 Returns true if successful, 208 265 */ 209 bool PickupCollection::addPickupable( Pickupable* pickup)266 bool PickupCollection::addPickupable(CollectiblePickup* pickup) 210 267 { 211 268 if(pickup == NULL) 212 269 return false; 213 270 214 WeakPtr<Pickupable> ptr = pickup; //!< Create a weak pointer to be able to test in the constructor if the Pointer is still valid.215 this->pickups_.push_back(p tr);271 pickup->addToCollection(this); 272 this->pickups_.push_back(pickup); 216 273 return true; 217 274 } … … 227 284 const Pickupable* PickupCollection::getPickupable(unsigned int index) 228 285 { 229 return this->pickups_[index].get(); 286 return this->pickups_[index]; 287 } 288 289 /** 290 @brief 291 Informs the PickupCollection, that one of its pickups has changed its used status to the input value. 292 This is used internally by the CollectiblePickup class. 293 @param changed 294 The value the used status has changed to. 295 */ 296 void PickupCollection::pickupChangedUsed(bool changed) 297 { 298 if(changed) 299 this->usedCounter_++; 300 else 301 this->usedCounter_--; 302 303 this->changedUsedAction(); 304 } 305 306 /** 307 @brief 308 Informs the PickupCollection, that one of its pickups has changed its picked up status to the input value. 309 This is used internally by the CollectiblePickup class. 310 @param changed 311 The value the picked up status has changed to. 312 */ 313 void PickupCollection::pickupChangedPickedUp(bool changed) 314 { 315 if(changed) 316 this->pickedUpCounter_++; 317 else 318 this->pickedUpCounter_--; 319 320 this->changedPickedUpAction(); 321 } 322 323 /** 324 @brief 325 Informs the PickupCollection, that one of its pickups has been disabled. 326 This is used internally by the CollectiblePickup class. 327 */ 328 void PickupCollection::pickupDisabled(void) 329 { 330 this->disabledCounter_++; 230 331 } 231 332 -
code/branches/presentation3/src/modules/pickup/PickupCollection.h
r7127 r7162 37 37 #include "PickupPrereqs.h" 38 38 39 #include "interfaces/Pickupable.h"40 39 #include "core/BaseObject.h" 40 #include "CollectiblePickup.h" 41 41 42 42 #include <list> … … 47 47 /** 48 48 @brief 49 The PickupCollection combines different Pickupables to a coherent, single pickup and makes the seem (from the outside looking in) just as if they were just one Pickupable.49 The PickupCollection combines different Pickupables to a coherent, single pickup and makes them seem (from the outside looking in) just as if they were just one Pickupable. 50 50 @author 51 51 Damian 'Mozork' Frick 52 52 */ 53 class _PickupExport PickupCollection : public Pickupable, public BaseObject53 class _PickupExport PickupCollection : public CollectiblePickup, public BaseObject 54 54 { 55 55 56 56 public: 57 58 57 PickupCollection(BaseObject* creator); //!< Default Constructor. 59 58 virtual ~PickupCollection(); //!< Destructor. … … 71 70 virtual const PickupIdentifier* getPickupIdentifier(void); //!< Get the PickupIdentifier of this PickupCollection. 72 71 73 bool addPickupable( Pickupable* pickup); //!< Add the input Pickupable to list of Pickupables combined by this PickupCollection.72 bool addPickupable(CollectiblePickup* pickup); //!< Add the input Pickupable to list of Pickupables combined by this PickupCollection. 74 73 const Pickupable* getPickupable(unsigned int index); //!< Get the Pickupable at the given index. 74 75 void pickupChangedUsed(bool changed); //!< Informs the PickupCollection, that one of its pickups has changed its used status to the input value. 76 void pickupChangedPickedUp(bool changed); //!< Informs the PickupCollection, that one of its pickups has changed its picked up status to the input value. 77 void pickupDisabled(void); //!< Informs the PickupCollection, that one of its pickups has been disabled. 75 78 76 79 protected: … … 82 85 83 86 private: 87 void changedUsedAction(void); //!< Helper method. 88 void changedPickedUpAction(void); //!< Helper method. 89 90 std::vector<CollectiblePickup*> pickups_; //!< The list of the pointers of all the Pickupables this PickupCollection consists of. They are weak pointers to facilitate testing, whether the pointers are still valid. 84 91 85 std::vector<WeakPtr<Pickupable> > pickups_; //!< The list of the pointers of all the Pickupables this PickupCollection consists of. They are weak pointers to facilitate testing, whether the pointers are still valid. 92 unsigned int usedCounter_; //!< Keeps track of the number of pickups of this PickupCollection, that are in use. 93 unsigned int pickedUpCounter_; //!< Keeps track of the number of pickups of this PickupCollection, that are picked up. 94 unsigned int disabledCounter_; //!< Keeps track of the number of pickups of this PickupCollection, that are disabled. 95 96 bool processingUsed_; //!< Boolean to ensure, that the PickupCollection doesn't update its used status while its internal state is inconsistent. 97 bool processingPickedUp_; //!< Boolean to ensure, that the PickupCollection doesn't update its picked upp status while its internal state is inconsistent. 86 98 87 99 }; -
code/branches/presentation3/src/modules/pickup/PickupCollectionIdentifier.cc
r7129 r7162 67 67 int PickupCollectionIdentifier::compare(const PickupIdentifier* identifier) const 68 68 { 69 // !Slight un-niceity to cast the PickupIdentifier to a PickupCollectionIdentifier.69 // Slight un-niceity to cast the PickupIdentifier to a PickupCollectionIdentifier. 70 70 PickupIdentifier* temp = const_cast<PickupIdentifier*>(identifier); 71 71 const PickupCollectionIdentifier* collectionIdentifier = dynamic_cast<PickupCollectionIdentifier*>(temp); 72 72 73 // !If the input PickupIdentifier 'identifier' is no PickupCollectionIdentifier then just the two PickupIdentifiers are compared.73 // If the input PickupIdentifier 'identifier' is no PickupCollectionIdentifier then just the two PickupIdentifiers are compared. 74 74 if(collectionIdentifier == NULL) 75 75 { … … 77 77 } 78 78 79 // !If the number of Pickupables each of the two PickupCollectionIdentifiers contain differ, the one with less is considered smaller.79 // If the number of Pickupables each of the two PickupCollectionIdentifiers contain differ, the one with less is considered smaller. 80 80 if(this->identifiers_.size() != collectionIdentifier->identifiers_.size()) 81 81 return this->identifiers_.size()-collectionIdentifier->identifiers_.size(); 82 82 83 // !Compare the Pickupables of the two PickupCollectionIdentifiers one after the other. the one with the first 'smaller' one is considered smaller.83 // Compare the Pickupables of the two PickupCollectionIdentifiers one after the other. the one with the first 'smaller' one is considered smaller. 84 84 std::set<const PickupIdentifier*, PickupIdentifierCompare>::const_iterator it2 = collectionIdentifier->identifiers_.begin(); 85 85 for(std::set<const PickupIdentifier*, PickupIdentifierCompare>::const_iterator it = this->identifiers_.begin(); it != this->identifiers_.end(); it++) -
code/branches/presentation3/src/modules/pickup/PickupManager.cc
r7150 r7162 43 43 #include "infos/PlayerInfo.h" 44 44 #include "worldentities/pawns/Pawn.h" 45 #include "CollectiblePickup.h" 45 46 #include "PickupRepresentation.h" 46 47 … … 64 65 RegisterRootObject(PickupManager); 65 66 67 //TODO: This doesn't work, yet. 66 68 if( GameMode::showsGraphics() ) 67 69 { … … 172 174 for(std::set<Pickupable*>::iterator pickup = pickups.begin(); pickup != pickups.end(); pickup++) 173 175 { 174 this->pickupsList_.insert(std::pair<Pickupable*, WeakPtr<Pickupable> >(*pickup, WeakPtr<Pickupable>(*pickup))); 176 CollectiblePickup* collectible = orxonox_cast<CollectiblePickup*>(*pickup); 177 if(collectible == NULL || !collectible->isInCollection()) 178 this->pickupsList_.insert(std::pair<Pickupable*, WeakPtr<Pickupable> >(*pickup, WeakPtr<Pickupable>(*pickup))); 175 179 } 176 180 } -
code/branches/presentation3/src/modules/pickup/PickupPrereqs.h
r7136 r7162 66 66 { 67 67 68 class CollectiblePickup; 68 69 class DroppedPickup; 69 70 class Pickup; -
code/branches/presentation3/src/modules/pickup/PickupRepresentation.h
r7129 r7162 149 149 std::string spawnerTemplate_; //!< The name of the template of this PickupRepresentation. 150 150 StaticEntity* spawnerRepresentation_; //!< The spawnerRepresentation of this PickupRepresentation. 151 std::string inventoryRepresentation_; //!< The name of an image representing the pickup in the PickupInventory. TODO: Exact format and placement of image?151 std::string inventoryRepresentation_; //!< The name of an image representing the pickup in the PickupInventory. 152 152 153 153 Pickupable* pickup_; //!< The Pickupable that is represented by this PickupRepresentation. -
code/branches/presentation3/src/modules/pickup/PickupSpawner.cc
r7150 r7162 107 107 this->maxSpawnedItems_ = INF; 108 108 this->spawnsRemaining_ = INF; 109 this->selfDestruct_ = false; 109 110 } 110 111 … … 115 116 PickupSpawner::~PickupSpawner() 116 117 { 117 if(this-> pickup_ != NULL)118 if(this->selfDestruct_ && this->pickup_ != NULL) 118 119 this->pickup_->destroy(); 119 120 } … … 176 177 if (this->isActive()) 177 178 { 178 SmartPtr<PickupSpawner> temp = this; // create a smart pointer to keep the PickupSpawner alive until we iterated through all Pawns (in case a Pawn takes the last pickup)179 SmartPtr<PickupSpawner> temp = this; //Create a smart pointer to keep the PickupSpawner alive until we iterated through all Pawns (in case a Pawn takes the last pickup) 179 180 180 181 //! Iterate trough all Pawns. … … 305 306 { 306 307 if(pickup->pickup(target)) 307 {308 308 this->decrementSpawnsRemaining(); 309 }310 309 else 311 310 { 311 this->selfDestruct_ = true; 312 312 pickup->destroy(); 313 313 } … … 319 319 320 320 if(pickup == NULL) 321 {322 321 COUT(1) << "PickupSpawner (&" << this << "): getPickup produced an error, no Pickupable created." << std::endl; 323 }324 322 else 325 323 { 324 this->selfDestruct_ = true; 326 325 pickup->destroy(); 327 326 } -
code/branches/presentation3/src/modules/pickup/PickupSpawner.h
r7127 r7162 125 125 Timer respawnTimer_; //!< Timer used for re-activating. 126 126 127 bool selfDestruct_; //!< True if the PickupSpawner is selfdestructing. 128 127 129 static const int INF = -1; //!< Constant for infinity. 128 130 }; -
code/branches/presentation3/src/modules/pickup/items/DronePickup.cc
r7127 r7162 131 131 Pawn* pawn = this->carrierToPawnHelper(); 132 132 if(pawn == NULL) //!< If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed. 133 this-> destroy();133 this->Pickupable::destroy(); 134 134 135 135 //Attach to pawn … … 155 155 if(this->isOnce() || (this->isContinuous() )) 156 156 { 157 this-> destroy();157 this->Pickupable::destroy(); 158 158 } 159 159 } -
code/branches/presentation3/src/modules/pickup/items/HealthPickup.cc
r7127 r7162 143 143 Pawn* pawn = this->carrierToPawnHelper(); 144 144 if(pawn == NULL) //!< If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed. 145 this-> destroy();145 this->Pickupable::destroy(); 146 146 147 147 //! Calculate the health that is added this tick. … … 191 191 192 192 //! If the pickup is not picked up nothing must be done. 193 if(!this->isPickedUp()) 193 if(!this->isPickedUp()) //TODO: Needed? 194 194 return; 195 195 … … 201 201 Pawn* pawn = this->carrierToPawnHelper(); 202 202 if(pawn == NULL) //!< If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed. 203 this-> destroy();203 this->Pickupable::destroy(); 204 204 205 205 float health = 0; … … 241 241 { 242 242 COUT(1) << "Something went horribly wrong in Health Pickup. PickupCarrier is no Pawn." << std::endl; 243 this-> destroy();243 this->Pickupable::destroy(); 244 244 return; 245 245 } … … 256 256 if(this->isOnce() || (this->isContinuous() && this->getHealth() == 0)) 257 257 { 258 this-> destroy();258 this->Pickupable::destroy(); 259 259 } 260 260 } -
code/branches/presentation3/src/modules/pickup/items/InvisiblePickup.cc
r7129 r7162 133 133 if(!this->getTimer()->isActive() && this->getTimer()->getRemainingTime() == this->getDuration()) 134 134 { 135 this-> destroy();135 this->Pickupable::destroy(); 136 136 } 137 137 else -
code/branches/presentation3/src/modules/pickup/items/MetaPickup.cc
r7150 r7162 34 34 #include "core/CoreIncludes.h" 35 35 #include "core/XMLPort.h" 36 #include "worldentities/pawns/Pawn.h" 36 37 #include "interfaces/PickupCarrier.h" 37 38 #include "pickup/PickupIdentifier.h" … … 47 48 /*static*/ const std::string MetaPickup::metaTypeUse_s = "use"; 48 49 /*static*/ const std::string MetaPickup::metaTypeDrop_s = "drop"; 50 /*static*/ const std::string MetaPickup::metaTypeDestroy_s = "destroy"; 51 /*static*/ const std::string MetaPickup::metaTypeDestroyCarrier_s = "destroyCarrier"; 49 52 50 53 /** … … 120 123 if(this->getMetaTypeDirect() != pickupMetaType::none && carrier != NULL) 121 124 { 125 if(this->getMetaTypeDirect() == pickupMetaType::destroyCarrier) 126 { 127 Pawn* pawn = orxonox_cast<Pawn*>(carrier); 128 pawn->kill(); 129 return; 130 } 122 131 std::set<Pickupable*> pickups = carrier->getPickups(); 123 //! Set all Pickupables carried by the PickupCarrier either to used or drop them, depending o the meta type.132 //! Set all Pickupables carried by the PickupCarrier either to used or drop them, depending on the meta type. 124 133 for(std::set<Pickupable*>::iterator it = pickups.begin(); it != pickups.end(); it++) 125 134 { … … 136 145 if(pickup != NULL && pickup != this) 137 146 { 138 pickup->drop(carrier); 147 pickup->drop(); 148 } 149 } 150 if(this->getMetaTypeDirect() == pickupMetaType::destroy) 151 { 152 if(pickup != NULL && pickup != this) 153 { 154 pickup->Pickupable::destroy(); 139 155 } 140 156 } 141 157 } 142 158 } 143 this-> destroy();159 this->Pickupable::destroy(); 144 160 } 145 161 } … … 180 196 case pickupMetaType::drop: 181 197 return MetaPickup::metaTypeDrop_s; 198 case pickupMetaType::destroy: 199 return MetaPickup::metaTypeDestroy_s; 200 case pickupMetaType::destroyCarrier: 201 return MetaPickup::metaTypeDestroyCarrier_s; 182 202 default: 183 203 return BLANKSTRING; … … 205 225 this->setMetaTypeDirect(pickupMetaType::drop); 206 226 } 227 else if(type == MetaPickup::metaTypeDestroy_s) 228 { 229 this->setMetaTypeDirect(pickupMetaType::destroy); 230 } 231 else if(type == MetaPickup::metaTypeDestroyCarrier_s) 232 { 233 this->setMetaTypeDirect(pickupMetaType::destroyCarrier); 234 } 235 else 236 COUT(2) << "Invalid metaType '" << type << "' in MetaPickup." << std::endl; 207 237 } 208 238 -
code/branches/presentation3/src/modules/pickup/items/MetaPickup.h
r7127 r7162 48 48 none, 49 49 use, 50 drop 50 drop, 51 destroy, 52 destroyCarrier 51 53 }; 52 54 } … … 54 56 /** 55 57 @brief 56 The MetaPickup is a pickup that can, depending on the parameters, either drop all pickups of the PickupCarrier that picks it up, or use all the unused pickups of the PickupCarrier, that picks it up. The parameter to set for this is the metaType and it can be used with the values 'none', 'drop' and 'use'. 58 The MetaPickup is a pickup that can, depending on the parameter 'metaType', do different things. If the 'metaType' is set to 59 1) 'use', all the pickups, the PickupCarrier has, are immediately set to used upon pickup of the MetaPickup. 60 2) 'drop', all the pickups, the PickupCarrier has, are immediately dropped upon pickup of the MetaPickup. 61 3) 'destroy', all the pickups, the PickupCarrier has, are immediately destroyed upon pickup of the MetaPickup. 62 4) 'destroyCarrier', the PickupCarrier is immediately destroyed upon pickup of the MetaPickup. 57 63 @author 58 64 Damian 'Mozork' Frick … … 98 104 static const std::string metaTypeUse_s; 99 105 static const std::string metaTypeDrop_s; 106 static const std::string metaTypeDestroy_s; 107 static const std::string metaTypeDestroyCarrier_s; 100 108 101 109 -
code/branches/presentation3/src/modules/pickup/items/ShieldPickup.cc
r7127 r7162 155 155 Pawn* pawn = this->carrierToPawnHelper(); 156 156 if(pawn == NULL) 157 this-> destroy();157 this->Pickupable::destroy(); 158 158 159 159 //! If the pickup has transited to used. … … 181 181 if(!this->getTimer()->isActive() && this->getTimer()->getRemainingTime() == this->getDuration()) 182 182 { 183 this-> destroy();183 this->Pickupable::destroy(); 184 184 } 185 185 else -
code/branches/presentation3/src/modules/pickup/items/SpeedPickup.cc
r7127 r7162 136 136 Engine* engine = this->carrierToEngineHelper(); 137 137 if(engine == NULL) //!< If the PickupCarrier is no Engine, then this pickup is useless and therefore is destroyed. 138 this-> destroy();138 this->Pickupable::destroy(); 139 139 140 140 //! If the pickup has transited to used. … … 161 161 if(!this->getTimer()->isActive() && this->getTimer()->getRemainingTime() == this->getDuration()) 162 162 { 163 this-> destroy();163 this->Pickupable::destroy(); 164 164 } 165 165 else
Note: See TracChangeset
for help on using the changeset viewer.