Changeset 11071 for code/trunk/src/modules/pickup/items/MetaPickup.cc
- Timestamp:
- Jan 17, 2016, 10:29:21 PM (8 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/modules/pickup/items/MetaPickup.cc
r9667 r11071 79 79 this->addTarget(ClassIdentifier<PickupCarrier>::getIdentifier()); 80 80 81 this->setDurationType( pickupDurationType::once);82 this->metaType_ = pickupMetaType::none;81 this->setDurationType(PickupDurationType::once); 82 this->metaType_ = PickupMetaType::none; 83 83 } 84 84 … … 104 104 105 105 // If the MetaPickup transited to used, and the metaType is not none. 106 if(this->isUsed() && this->metaType_ != pickupMetaType::none)106 if(this->isUsed() && this->metaType_ != PickupMetaType::none) 107 107 { 108 108 PickupCarrier* carrier = this->getCarrier(); 109 if(this->getMetaType() != pickupMetaType::none && carrier != NULL)109 if(this->getMetaType() != PickupMetaType::none && carrier != nullptr) 110 110 { 111 111 // If the metaType is destroyCarrier, then the PickupCarrier is destroyed. 112 if(this->getMetaType() == pickupMetaType::destroyCarrier)112 if(this->getMetaType() == PickupMetaType::destroyCarrier) 113 113 { 114 114 Pawn* pawn = orxonox_cast<Pawn*>(carrier); … … 118 118 std::set<Pickupable*> pickups = carrier->getPickups(); 119 119 // Iterate over all Pickupables of the PickupCarrier. 120 for( std::set<Pickupable*>::iterator it = pickups.begin(); it != pickups.end(); it++)120 for(Pickupable* pickup : pickups) 121 121 { 122 Pickupable* pickup = (*it); 123 if(pickup == NULL || pickup == this) 122 if(pickup == nullptr || pickup == this) 124 123 continue; 125 124 126 125 // If the metaType is use, then the Pickupable is set to used. 127 if(this->getMetaType() == pickupMetaType::use && !pickup->isUsed())126 if(this->getMetaType() == PickupMetaType::use && !pickup->isUsed()) 128 127 { 129 128 pickup->setUsed(true); 130 129 } 131 130 // If the metaType is drop, then the Pickupable is dropped. 132 else if(this->getMetaType() == pickupMetaType::drop)131 else if(this->getMetaType() == PickupMetaType::drop) 133 132 { 134 133 pickup->drop(); 135 134 } 136 135 // If the metaType is destroy, then the Pickupable is destroyed. 137 else if(this->getMetaType() == pickupMetaType::destroy)136 else if(this->getMetaType() == PickupMetaType::destroy) 138 137 { 139 138 pickup->Pickupable::destroy(); … … 155 154 switch(this->getMetaType()) 156 155 { 157 case pickupMetaType::none:156 case PickupMetaType::none: 158 157 return MetaPickup::metaTypeNone_s; 159 case pickupMetaType::use:158 case PickupMetaType::use: 160 159 return MetaPickup::metaTypeUse_s; 161 case pickupMetaType::drop:160 case PickupMetaType::drop: 162 161 return MetaPickup::metaTypeDrop_s; 163 case pickupMetaType::destroy:162 case PickupMetaType::destroy: 164 163 return MetaPickup::metaTypeDestroy_s; 165 case pickupMetaType::destroyCarrier:164 case PickupMetaType::destroyCarrier: 166 165 return MetaPickup::metaTypeDestroyCarrier_s; 167 166 default: … … 180 179 if(type == MetaPickup::metaTypeNone_s) 181 180 { 182 this->setMetaType( pickupMetaType::none);181 this->setMetaType(PickupMetaType::none); 183 182 } 184 183 else if(type == MetaPickup::metaTypeUse_s) 185 184 { 186 this->setMetaType( pickupMetaType::use);185 this->setMetaType(PickupMetaType::use); 187 186 } 188 187 else if(type == MetaPickup::metaTypeDrop_s) 189 188 { 190 this->setMetaType( pickupMetaType::drop);189 this->setMetaType(PickupMetaType::drop); 191 190 } 192 191 else if(type == MetaPickup::metaTypeDestroy_s) 193 192 { 194 this->setMetaType( pickupMetaType::destroy);193 this->setMetaType(PickupMetaType::destroy); 195 194 } 196 195 else if(type == MetaPickup::metaTypeDestroyCarrier_s) 197 196 { 198 this->setMetaType( pickupMetaType::destroyCarrier);197 this->setMetaType(PickupMetaType::destroyCarrier); 199 198 } 200 199 else
Note: See TracChangeset
for help on using the changeset viewer.