Changeset 9312 for code/branches/presentation2012merge/src
- Timestamp:
- Jul 8, 2012, 5:26:04 PM (12 years ago)
- Location:
- code/branches/presentation2012merge/src/modules/pickup/items
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2012merge/src/modules/pickup/items/DronePickup.cc
r9305 r9312 106 106 The name of the Template to e set. 107 107 */ 108 void DronePickup::setDroneTemplate( std::stringtemplatename){108 void DronePickup::setDroneTemplate(const std::string& templatename){ 109 109 droneTemplate_ = templatename; 110 110 } -
code/branches/presentation2012merge/src/modules/pickup/items/DronePickup.h
r7547 r9312 77 77 void initializeIdentifier(void); //!< Initializes the PickupIdentifier of this pickup. 78 78 79 void setDroneTemplate( std::stringtemplatename); //!< Set the droneTemplate.79 void setDroneTemplate(const std::string& templatename); //!< Set the droneTemplate. 80 80 81 81 private: -
code/branches/presentation2012merge/src/modules/pickup/items/HealthPickup.cc
r9305 r9312 106 106 XMLPortParam(HealthPickup, "health", setHealth, getHealth, xmlelement, mode); 107 107 XMLPortParam(HealthPickup, "healthRate", setHealthRate, getHealthRate, xmlelement, mode); 108 XMLPortParam(HealthPickup, "healthType", setHealthType , getHealthType, xmlelement, mode);108 XMLPortParam(HealthPickup, "healthType", setHealthTypeAsString, getHealthTypeAsString, xmlelement, mode); 109 109 110 110 if(!this->isContinuous()) 111 this-> healthRate_ = 0.0f;111 this->setHealthRate(0.0f); // TODO: this logic should be inside tick(), not in XMLPort 112 112 113 113 this->initializeIdentifier(); … … 139 139 this->setHealth(this->getHealth()-health); 140 140 141 switch(this->getHealthType Direct())141 switch(this->getHealthType()) 142 142 { 143 143 case pickupHealthType::permanent: … … 186 186 187 187 float health = 0.0f; 188 switch(this->getHealthType Direct())188 switch(this->getHealthType()) 189 189 { 190 190 case pickupHealthType::permanent: … … 215 215 else 216 216 { 217 if(this->getHealthType Direct() == pickupHealthType::temporary)217 if(this->getHealthType() == pickupHealthType::temporary) 218 218 { 219 219 PickupCarrier* carrier = this->getCarrier(); … … 276 276 pickup->setHealth(this->getHealth()); 277 277 pickup->setHealthRate(this->getHealthRate()); 278 pickup->setHealthType Direct(this->getHealthTypeDirect());278 pickup->setHealthType(this->getHealthType()); 279 279 280 280 pickup->initializeIdentifier(); … … 287 287 Returns the health type as a string. 288 288 */ 289 const std::string& HealthPickup::getHealthType (void) const290 { 291 switch(this->getHealthType Direct())289 const std::string& HealthPickup::getHealthTypeAsString(void) const 290 { 291 switch(this->getHealthType()) 292 292 { 293 293 case pickupHealthType::limited: … … 340 340 The type as a string. 341 341 */ 342 void HealthPickup::setHealthType (std::stringtype)342 void HealthPickup::setHealthTypeAsString(const std::string& type) 343 343 { 344 344 if(type == HealthPickup::healthTypeLimited_s) 345 this->setHealthType Direct(pickupHealthType::limited);345 this->setHealthType(pickupHealthType::limited); 346 346 else if(type == HealthPickup::healthTypeTemporary_s) 347 this->setHealthType Direct(pickupHealthType::temporary);347 this->setHealthType(pickupHealthType::temporary); 348 348 else if(type == HealthPickup::healthTypePermanent_s) 349 this->setHealthType Direct(pickupHealthType::permanent);349 this->setHealthType(pickupHealthType::permanent); 350 350 else 351 351 orxout(internal_error, context::pickups) << "Invalid healthType '" << type << "' in HealthPickup." << endl; -
code/branches/presentation2012merge/src/modules/pickup/items/HealthPickup.h
r7551 r9312 116 116 @return Returns the health type as an enum. 117 117 */ 118 inline pickupHealthType::Value getHealthType Direct(void) const118 inline pickupHealthType::Value getHealthType(void) const 119 119 { return this->healthType_; } 120 const std::string& getHealthType (void) const; //!< Get the health type of this pickup.120 const std::string& getHealthTypeAsString(void) const; //!< Get the health type of this pickup. 121 121 122 122 protected: … … 130 130 @param type The type of this pickup as an enum. 131 131 */ 132 inline void setHealthType Direct(pickupHealthType::Value type)132 inline void setHealthType(pickupHealthType::Value type) 133 133 { this->healthType_ = type; } 134 void setHealthType (std::stringtype); //!< Set the type of the HealthPickup.134 void setHealthTypeAsString(const std::string& type); //!< Set the type of the HealthPickup. 135 135 136 136 private: -
code/branches/presentation2012merge/src/modules/pickup/items/MetaPickup.cc
r9305 r9312 101 101 SUPER(MetaPickup, XMLPort, xmlelement, mode); 102 102 103 XMLPortParam(MetaPickup, "metaType", setMetaType , getMetaType, xmlelement, mode);103 XMLPortParam(MetaPickup, "metaType", setMetaTypeAsString, getMetaTypeAsString, xmlelement, mode); 104 104 105 105 this->initializeIdentifier(); … … 119 119 { 120 120 PickupCarrier* carrier = this->getCarrier(); 121 if(this->getMetaType Direct() != pickupMetaType::none && carrier != NULL)121 if(this->getMetaType() != pickupMetaType::none && carrier != NULL) 122 122 { 123 123 // If the metaType is destroyCarrier, then the PickupCarrier is destroyed. 124 if(this->getMetaType Direct() == pickupMetaType::destroyCarrier)124 if(this->getMetaType() == pickupMetaType::destroyCarrier) 125 125 { 126 126 Pawn* pawn = orxonox_cast<Pawn*>(carrier); … … 137 137 138 138 // If the metaType is use, then the Pickupable is set to used. 139 if(this->getMetaType Direct() == pickupMetaType::use && !pickup->isUsed())139 if(this->getMetaType() == pickupMetaType::use && !pickup->isUsed()) 140 140 { 141 141 pickup->setUsed(true); 142 142 } 143 143 // If the metaType is drop, then the Pickupable is dropped. 144 else if(this->getMetaType Direct() == pickupMetaType::drop)144 else if(this->getMetaType() == pickupMetaType::drop) 145 145 { 146 146 pickup->drop(); 147 147 } 148 148 // If the metaType is destroy, then the Pickupable is destroyed. 149 else if(this->getMetaType Direct() == pickupMetaType::destroy)149 else if(this->getMetaType() == pickupMetaType::destroy) 150 150 { 151 151 pickup->Pickupable::destroy(); … … 171 171 172 172 MetaPickup* pickup = orxonox_cast<MetaPickup*>(item); 173 pickup->setMetaType Direct(this->getMetaTypeDirect());173 pickup->setMetaType(this->getMetaType()); 174 174 175 175 pickup->initializeIdentifier(); … … 182 182 Returns a string with the meta type of the MetaPickup. 183 183 */ 184 const std::string& MetaPickup::getMetaType (void) const185 { 186 switch(this->getMetaType Direct())184 const std::string& MetaPickup::getMetaTypeAsString(void) const 185 { 186 switch(this->getMetaType()) 187 187 { 188 188 case pickupMetaType::none: … … 207 207 A string with the type to be set. 208 208 */ 209 void MetaPickup::setMetaType (const std::string& type)209 void MetaPickup::setMetaTypeAsString(const std::string& type) 210 210 { 211 211 if(type == MetaPickup::metaTypeNone_s) 212 212 { 213 this->setMetaType Direct(pickupMetaType::none);213 this->setMetaType(pickupMetaType::none); 214 214 } 215 215 else if(type == MetaPickup::metaTypeUse_s) 216 216 { 217 this->setMetaType Direct(pickupMetaType::use);217 this->setMetaType(pickupMetaType::use); 218 218 } 219 219 else if(type == MetaPickup::metaTypeDrop_s) 220 220 { 221 this->setMetaType Direct(pickupMetaType::drop);221 this->setMetaType(pickupMetaType::drop); 222 222 } 223 223 else if(type == MetaPickup::metaTypeDestroy_s) 224 224 { 225 this->setMetaType Direct(pickupMetaType::destroy);225 this->setMetaType(pickupMetaType::destroy); 226 226 } 227 227 else if(type == MetaPickup::metaTypeDestroyCarrier_s) 228 228 { 229 this->setMetaType Direct(pickupMetaType::destroyCarrier);229 this->setMetaType(pickupMetaType::destroyCarrier); 230 230 } 231 231 else -
code/branches/presentation2012merge/src/modules/pickup/items/MetaPickup.h
r7547 r9312 69 69 70 70 The default value is <em>none</em>, which basically does nothing. 71 71 72 72 The parameter <b>activation type</b> can be used to specify, whether the MetaPickup is used upon pickup (<em>immediate</em>) or not (<em>onUse</em>). With <em>immediate</em> being the default. 73 73 … … 101 101 @return Returns an enum with the meta type of the MetaPickup. 102 102 */ 103 inline pickupMetaType::Value getMetaType Direct(void) const103 inline pickupMetaType::Value getMetaType(void) const 104 104 { return this->metaType_; } 105 const std::string& getMetaType (void) const; //!< Get the meta type of this MetaPickup.105 const std::string& getMetaTypeAsString(void) const; //!< Get the meta type of this MetaPickup. 106 106 107 107 protected: … … 112 112 @param type The meta type as an enum. 113 113 */ 114 inline void setMetaType Direct(pickupMetaType::Value type)114 inline void setMetaType(pickupMetaType::Value type) 115 115 { this->metaType_ = type; } 116 void setMetaType (const std::string& type); //!< Set the meta type of this MetaPickup.116 void setMetaTypeAsString(const std::string& type); //!< Set the meta type of this MetaPickup. 117 117 118 118 private:
Note: See TracChangeset
for help on using the changeset viewer.