Changeset 7162 for code/branches/presentation3/src/modules/pickup/items
- Timestamp:
- Aug 8, 2010, 8:53:52 PM (14 years ago)
- Location:
- code/branches/presentation3/src/modules/pickup/items
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
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.