- Timestamp:
- Dec 30, 2015, 1:59:38 PM (9 years ago)
- Location:
- code/branches/cpp11_v2/src/modules
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v2/src/modules/objects/triggers/DistanceMultiTrigger.cc
r10916 r10998 58 58 59 59 this->distance_ = 100.0f; 60 this->setBeaconModeDirect( distanceMultiTriggerBeaconMode::off);60 this->setBeaconModeDirect(DistanceMultiTriggerBeaconMode::off); 61 61 this->targetName_ = ""; 62 62 this->beaconMask_.exclude(Class(BaseObject)); … … 136 136 ClassTreeMask targetMask = this->getTargetMask(); 137 137 // If we are in identify-mode another target mask has to be applies to find the DistanceTriggerBeacons. 138 if(this->beaconMode_ == distanceMultiTriggerBeaconMode::identify)138 if(this->beaconMode_ == DistanceMultiTriggerBeaconMode::identify) 139 139 targetMask = this->beaconMask_; 140 140 … … 145 145 146 146 // If the DistanceMultiTrigger is in identify-mode and the DistanceTriggerBeacon attached to the object has the wrong name we ignore it. 147 if(this->beaconMode_ == distanceMultiTriggerBeaconMode::identify)147 if(this->beaconMode_ == DistanceMultiTriggerBeaconMode::identify) 148 148 { 149 149 if(entity->getName() != this->targetName_) … … 155 155 156 156 // If the DistanceMultiTrigger is in exclude mode and the DistanceTriggerBeacon attached to the object has the right name, we ignore it. 157 if(this->beaconMode_ == distanceMultiTriggerBeaconMode::exclude)157 if(this->beaconMode_ == DistanceMultiTriggerBeaconMode::exclude) 158 158 { 159 159 … … 182 182 183 183 // Change the entity to the parent of the DistanceTriggerBeacon (if in identify-mode), which is the entity to which the beacon is attached. 184 if(this->beaconMode_ == distanceMultiTriggerBeaconMode::identify)184 if(this->beaconMode_ == DistanceMultiTriggerBeaconMode::identify) 185 185 entity = entity->getParent(); 186 186 … … 206 206 The mode as an enum. 207 207 */ 208 void DistanceMultiTrigger::setBeaconModeDirect( distanceMultiTriggerBeaconMode::Value mode)208 void DistanceMultiTrigger::setBeaconModeDirect(DistanceMultiTriggerBeaconMode mode) 209 209 { 210 210 this->beaconMode_ = mode; … … 221 221 switch(this->getBeaconModeDirect()) 222 222 { 223 case distanceMultiTriggerBeaconMode::off :223 case DistanceMultiTriggerBeaconMode::off : 224 224 return DistanceMultiTrigger::beaconModeOff_s; 225 case distanceMultiTriggerBeaconMode::identify:225 case DistanceMultiTriggerBeaconMode::identify: 226 226 return DistanceMultiTrigger::beaconModeIdentify_s; 227 case distanceMultiTriggerBeaconMode::exclude:227 case DistanceMultiTriggerBeaconMode::exclude: 228 228 return DistanceMultiTrigger::beaconModeExlcude_s; 229 229 default : … … 242 242 { 243 243 if(mode == DistanceMultiTrigger::beaconModeOff_s) 244 this->setBeaconModeDirect( distanceMultiTriggerBeaconMode::off);244 this->setBeaconModeDirect(DistanceMultiTriggerBeaconMode::off); 245 245 else if(mode == DistanceMultiTrigger::beaconModeIdentify_s) 246 this->setBeaconModeDirect( distanceMultiTriggerBeaconMode::identify);246 this->setBeaconModeDirect(DistanceMultiTriggerBeaconMode::identify); 247 247 else if(mode == DistanceMultiTrigger::beaconModeExlcude_s) 248 this->setBeaconModeDirect( distanceMultiTriggerBeaconMode::exclude);248 this->setBeaconModeDirect(DistanceMultiTriggerBeaconMode::exclude); 249 249 else 250 250 orxout(internal_error, context::triggers) << "Invalid beacon mode in DistanceMultiTrigger." << endl; -
code/branches/cpp11_v2/src/modules/objects/triggers/DistanceMultiTrigger.h
r10769 r10998 55 55 @ingroup MultiTrigger 56 56 */ 57 namespace distanceMultiTriggerBeaconMode 58 { 59 enum Value { 60 off, //!< The DistanceMultiTrigger is not in <em>beacon-mode</em>. 61 identify, //!< The DistanceTrigger is in <em>identify-mode</em>. 62 exclude //!< The DistanceTrigger is in <em>exclude-mode</em>. 63 }; 64 } 57 enum class DistanceMultiTriggerBeaconMode { 58 off, //!< The DistanceMultiTrigger is not in <em>beacon-mode</em>. 59 identify, //!< The DistanceTrigger is in <em>identify-mode</em>. 60 exclude //!< The DistanceTrigger is in <em>exclude-mode</em>. 61 }; 65 62 66 63 /** … … 113 110 { return this->distance_; } 114 111 115 void setBeaconModeDirect( distanceMultiTriggerBeaconMode::Value mode); // Set the beacon mode.112 void setBeaconModeDirect(DistanceMultiTriggerBeaconMode mode); // Set the beacon mode. 116 113 /** 117 114 @brief Get the beacon mode. 118 115 @return Returns the mode as an enum. 119 116 */ 120 inline distanceMultiTriggerBeaconMode::Value getBeaconModeDirect(void) const117 inline DistanceMultiTriggerBeaconMode getBeaconModeDirect(void) const 121 118 { return this->beaconMode_; } 122 119 void setBeaconMode(const std::string& mode); // Set the beacon mode. … … 149 146 float distance_; //!< The distance at which the DistanceMultiTrigger triggers. 150 147 151 distanceMultiTriggerBeaconMode::Value beaconMode_; //!< The beacon mode, the DistanceMultiTrigger is in.148 DistanceMultiTriggerBeaconMode beaconMode_; //!< The beacon mode, the DistanceMultiTrigger is in. 152 149 std::string targetName_; //!< The target name, used in <em>single-target</em> mode. 153 150 ClassTreeMask beaconMask_; //!< A mask, that only accepts DistanceTriggerBeacons. -
code/branches/cpp11_v2/src/modules/objects/triggers/DistanceTrigger.cc
r10916 r10998 158 158 ClassTreeMask targetMask = this->targetMask_; 159 159 // If we are in identify-mode another target mask has to be applies to find the DistanceTriggerBeacons. 160 if(this->beaconMode_ == distanceTriggerBeaconMode::identify)160 if(this->beaconMode_ == DistanceTriggerBeaconMode::identify) 161 161 targetMask = this->beaconMask_; 162 162 … … 167 167 168 168 // If the DistanceTrigger is in identify-mode and the DistanceTriggerBeacon attached to the object has the wrong name we ignore it. 169 if(this->beaconMode_ == distanceTriggerBeaconMode::identify)169 if(this->beaconMode_ == DistanceTriggerBeaconMode::identify) 170 170 { 171 171 if(entity->getName() != this->targetName_) … … 177 177 178 178 // If the DistanceTrigger is in exclude mode and the DistanceTriggerBeacon attached to the object has the right name, we ignore it. 179 if(this->beaconMode_ == distanceTriggerBeaconMode::exclude)179 if(this->beaconMode_ == DistanceTriggerBeaconMode::exclude) 180 180 { 181 181 … … 202 202 { 203 203 // Change the entity to the parent of the DistanceTriggerBeacon (if in identify-mode), which is the entity to which the beacon is attached. 204 if(this->beaconMode_ == distanceTriggerBeaconMode::identify)204 if(this->beaconMode_ == DistanceTriggerBeaconMode::identify) 205 205 entity = entity->getParent(); 206 206 … … 228 228 The mode as an enum. 229 229 */ 230 void DistanceTrigger::setBeaconModeDirect( distanceTriggerBeaconMode::Value mode)230 void DistanceTrigger::setBeaconModeDirect(DistanceTriggerBeaconMode mode) 231 231 { 232 232 this->beaconMode_ = mode; … … 243 243 switch(this->getBeaconModeDirect()) 244 244 { 245 case distanceTriggerBeaconMode::off :245 case DistanceTriggerBeaconMode::off : 246 246 return DistanceTrigger::beaconModeOff_s; 247 case distanceTriggerBeaconMode::identify:247 case DistanceTriggerBeaconMode::identify: 248 248 return DistanceTrigger::beaconModeIdentify_s; 249 case distanceTriggerBeaconMode::exclude:249 case DistanceTriggerBeaconMode::exclude: 250 250 return DistanceTrigger::beaconModeExlcude_s; 251 251 default : … … 264 264 { 265 265 if(mode == DistanceTrigger::beaconModeOff_s) 266 this->setBeaconModeDirect( distanceTriggerBeaconMode::off);266 this->setBeaconModeDirect(DistanceTriggerBeaconMode::off); 267 267 else if(mode == DistanceTrigger::beaconModeIdentify_s) 268 this->setBeaconModeDirect( distanceTriggerBeaconMode::identify);268 this->setBeaconModeDirect(DistanceTriggerBeaconMode::identify); 269 269 else if(mode == DistanceTrigger::beaconModeExlcude_s) 270 this->setBeaconModeDirect( distanceTriggerBeaconMode::exclude);270 this->setBeaconModeDirect(DistanceTriggerBeaconMode::exclude); 271 271 else 272 272 orxout(internal_error, context::triggers) << "Invalid beacon mode in DistanceTrigger." << endl; … … 282 282 Returns true if it is triggered ,false if not. 283 283 */ 284 bool DistanceTrigger::isTriggered(TriggerMode ::Valuemode)284 bool DistanceTrigger::isTriggered(TriggerMode mode) 285 285 { 286 286 if (Trigger::isTriggered(mode)) -
code/branches/cpp11_v2/src/modules/objects/triggers/DistanceTrigger.h
r9667 r10998 55 55 @ingroup NormalTrigger 56 56 */ 57 namespace distanceTriggerBeaconMode 58 { 59 enum Value { 60 off, 61 identify, 62 exclude 63 }; 64 } 57 enum class DistanceTriggerBeaconMode { 58 off, 59 identify, 60 exclude 61 }; 65 62 66 63 /** … … 118 115 { return this->distance_; } 119 116 120 void setBeaconModeDirect( distanceTriggerBeaconMode::Value mode); // Set the beacon mode.117 void setBeaconModeDirect(DistanceTriggerBeaconMode mode); // Set the beacon mode. 121 118 /** 122 119 @brief Get the beacon mode. 123 120 @return Returns the mode as an enum. 124 121 */ 125 inline distanceTriggerBeaconMode::Value getBeaconModeDirect(void) const122 inline DistanceTriggerBeaconMode getBeaconModeDirect(void) const 126 123 { return this->beaconMode_; } 127 124 void setBeaconMode(const std::string& mode); // Set the beacon mode. … … 144 141 145 142 protected: 146 virtual bool isTriggered(TriggerMode ::Value mode); // Check whether the DistanceTrigger is triggered.143 virtual bool isTriggered(TriggerMode mode) override; // Check whether the DistanceTrigger is triggered. 147 144 /** 148 145 @brief Notifies interested parties about a change of the DistanceTrigger's target mask. … … 160 157 float distance_; //!< The range of the DistanceTrigger. 161 158 162 distanceTriggerBeaconMode::Value beaconMode_; //!< The beacon mode.159 DistanceTriggerBeaconMode beaconMode_; //!< The beacon mode. 163 160 std::string targetName_; //!< The name a DistanceTriggerBeacon needs to have to make the DistanceTrigger react to it if in beacon-mode. 164 161 ClassTreeMask beaconMask_; //!< A mask, that only accepts DistanceTriggerBeacons. -
code/branches/cpp11_v2/src/modules/objects/triggers/EventTrigger.cc
r9667 r10998 79 79 It should be triggered if it is triggered according just to its sub-triggers and if the last event that came in was an event that changed from not triggered to triggered. 80 80 */ 81 bool EventTrigger::isTriggered(TriggerMode ::Valuemode)81 bool EventTrigger::isTriggered(TriggerMode mode) 82 82 { 83 83 if (Trigger::isTriggered(mode)) -
code/branches/cpp11_v2/src/modules/objects/triggers/EventTrigger.h
r9667 r10998 84 84 85 85 protected: 86 virtual bool isTriggered(TriggerMode ::Value mode); // Check whether the EventTrigger should be triggered.86 virtual bool isTriggered(TriggerMode mode) override; // Check whether the EventTrigger should be triggered. 87 87 88 88 private: -
code/branches/cpp11_v2/src/modules/objects/triggers/Trigger.cc
r10919 r10998 203 203 Returns true if the Trigger should be triggered and false if not. 204 204 */ 205 bool Trigger::isTriggered(TriggerMode ::Valuemode)205 bool Trigger::isTriggered(TriggerMode mode) 206 206 { 207 207 // If the trigger has sub-triggers. -
code/branches/cpp11_v2/src/modules/objects/triggers/Trigger.h
r10769 r10998 105 105 inline bool isTriggered() 106 106 { return this->isTriggered(this->mode_); } 107 virtual bool isTriggered(TriggerMode ::Valuemode); // Check whether the Trigger should be triggered, given only its sub-triggers, given a specific mode.107 virtual bool isTriggered(TriggerMode mode); // Check whether the Trigger should be triggered, given only its sub-triggers, given a specific mode. 108 108 virtual void triggered(bool bIsTriggered); // Fires an event with the input triggered state. 109 109 -
code/branches/cpp11_v2/src/modules/objects/triggers/TriggerBase.h
r9667 r10998 52 52 @ingroup Triggers 53 53 */ 54 namespaceTriggerMode54 enum class TriggerMode 55 55 { 56 enum Value 57 { 58 EventTriggerAND, //!< The <em>and</em> mode. The trigger can only trigger if all the children are active. 59 EventTriggerOR, //!< The <em>or</em> mode. The trigger can only trigger if at least one child is active. 60 EventTriggerXOR, //!< The <em>xor</em> mode. The trigger can only trigger if exactly one child is active. 61 }; 62 } 56 EventTriggerAND, //!< The <em>and</em> mode. The trigger can only trigger if all the children are active. 57 EventTriggerOR, //!< The <em>or</em> mode. The trigger can only trigger if at least one child is active. 58 EventTriggerXOR, //!< The <em>xor</em> mode. The trigger can only trigger if exactly one child is active. 59 }; 63 60 64 61 /** … … 158 155 @param mode The mode of the trigger. 159 156 */ 160 inline void setMode(TriggerMode ::Valuemode) //!< Get the mode of the trigger.157 inline void setMode(TriggerMode mode) //!< Get the mode of the trigger. 161 158 { this->mode_ = mode; } 162 159 const std::string& getModeString(void) const; … … 165 162 @return Returns and Enum for the mode of the trigger. 166 163 */ 167 inline TriggerMode ::ValuegetMode(void) const164 inline TriggerMode getMode(void) const 168 165 { return mode_; } 169 166 … … 211 208 212 209 bool bInvertMode_; //!< Bool for the invert-mode, if true the trigger is inverted. 213 TriggerMode ::Valuemode_; //!< The mode of the trigger.210 TriggerMode mode_; //!< The mode of the trigger. 214 211 215 212 TriggerBase* parent_; //!< The parent of this trigger. -
code/branches/cpp11_v2/src/modules/pickup/Pickup.cc
r9667 r10998 78 78 void Pickup::initialize(void) 79 79 { 80 this->activationType_ = pickupActivationType::immediate;81 this->durationType_ = pickupDurationType::once;80 this->activationType_ = PickupActivationType::immediate; 81 this->durationType_ = PickupDurationType::once; 82 82 } 83 83 … … 105 105 switch(this->getActivationType()) 106 106 { 107 case pickupActivationType::immediate:107 case PickupActivationType::immediate: 108 108 return activationTypeImmediate_s; 109 case pickupActivationType::onUse:109 case PickupActivationType::onUse: 110 110 return activationTypeOnUse_s; 111 111 default: … … 124 124 switch(this->getDurationType()) 125 125 { 126 case pickupDurationType::once:126 case PickupDurationType::once: 127 127 return durationTypeOnce_s; 128 case pickupDurationType::continuous:128 case PickupDurationType::continuous: 129 129 return durationTypeContinuous_s; 130 130 default: … … 142 142 { 143 143 if(type == Pickup::activationTypeImmediate_s) 144 this->setActivationType( pickupActivationType::immediate);144 this->setActivationType(PickupActivationType::immediate); 145 145 else if(type == Pickup::activationTypeOnUse_s) 146 this->setActivationType( pickupActivationType::onUse);146 this->setActivationType(PickupActivationType::onUse); 147 147 else 148 148 orxout(internal_error, context::pickups) << "Invalid activationType '" << type << "' in " << this->getIdentifier()->getName() << "." << endl; … … 158 158 { 159 159 if(type == Pickup::durationTypeOnce_s) 160 this->setDurationType( pickupDurationType::once);160 this->setDurationType(PickupDurationType::once); 161 161 else if(type == Pickup::durationTypeContinuous_s) 162 this->setDurationType( pickupDurationType::continuous);162 this->setDurationType(PickupDurationType::continuous); 163 163 else 164 164 orxout(internal_error, context::pickups) << "Invalid durationType '" << type << "' in " << this->getIdentifier()->getName() << "." << endl; -
code/branches/cpp11_v2/src/modules/pickup/Pickup.h
r10817 r10998 53 53 @ingroup Pickup 54 54 */ 55 namespace pickupActivationType55 enum class PickupActivationType 56 56 { 57 enum Value 58 { 59 immediate, //!< Means that the @ref orxonox::Pickup "Pickup" will be used immediately after pickup. 60 onUse, //!< Means that the @ref orxonox::Pickup "Pickup" will be used at a later point trough some external influence. 61 }; 62 } 57 immediate, //!< Means that the @ref orxonox::Pickup "Pickup" will be used immediately after pickup. 58 onUse, //!< Means that the @ref orxonox::Pickup "Pickup" will be used at a later point trough some external influence. 59 }; 63 60 64 61 /** … … 68 65 @ingroup Pickup 69 66 */ 70 namespace pickupDurationType67 enum class PickupDurationType 71 68 { 72 enum Value 73 { 74 once, //!< Means that the @ref orxonox::Pickup "Pickup" will be used only once at a singular time instant. 75 continuous, //!< Means that the @ref orxonox::Pickup "Pickup" will be used over a continuous timespan. 76 }; 77 } 69 once, //!< Means that the @ref orxonox::Pickup "Pickup" will be used only once at a singular time instant. 70 continuous, //!< Means that the @ref orxonox::Pickup "Pickup" will be used over a continuous timespan. 71 }; 78 72 79 73 /** … … 112 106 @return Returns the activation type of the Pickup. 113 107 */ 114 inline pickupActivationType::Value getActivationType(void) const108 inline PickupActivationType getActivationType(void) const 115 109 { return this->activationType_; } 116 110 /** … … 118 112 @return Returns the duration type of the Pickup. 119 113 */ 120 inline pickupDurationType::Value getDurationType(void) const114 inline PickupDurationType getDurationType(void) const 121 115 { return this->durationType_; } 122 116 … … 129 123 */ 130 124 inline bool isImmediate(void) const 131 { return this->getActivationType() == pickupActivationType::immediate; }125 { return this->getActivationType() == PickupActivationType::immediate; } 132 126 /** 133 127 @brief Get whether the activation type is 'onUse'. … … 135 129 */ 136 130 inline bool isOnUse(void) const 137 { return this->getActivationType() == pickupActivationType::onUse; }131 { return this->getActivationType() == PickupActivationType::onUse; } 138 132 /** 139 133 @brief Get whether the duration type is 'once'. … … 141 135 */ 142 136 inline bool isOnce(void) const 143 { return this->getDurationType() == pickupDurationType::once; }137 { return this->getDurationType() == PickupDurationType::once; } 144 138 /** 145 139 @brief Get whether the duration type is 'continuous'. … … 147 141 */ 148 142 inline bool isContinuous(void) const 149 { return this->getDurationType() == pickupDurationType::continuous; }143 { return this->getDurationType() == PickupDurationType::continuous; } 150 144 151 145 virtual void changedPickedUp(void) override; //!< Should be called when the pickup has transited from picked up to dropped or the other way around. … … 164 158 @param type The activation type of the Pickup. 165 159 */ 166 inline void setActivationType( pickupActivationType::Value type)160 inline void setActivationType(PickupActivationType type) 167 161 { this->activationType_ = type; } 168 162 /** … … 170 164 @param type The duration type of the Pickup. 171 165 */ 172 inline void setDurationType( pickupDurationType::Value type)166 inline void setDurationType(PickupDurationType type) 173 167 { this->durationType_ = type; } 174 168 … … 180 174 181 175 std::string representationName_; //!< The name of the associated PickupRepresentation. 182 pickupActivationType::Value activationType_; //!< The activation type of the Pickup.183 pickupDurationType::Value durationType_; //!< The duration type of the Pickup.176 PickupActivationType activationType_; //!< The activation type of the Pickup. 177 PickupDurationType durationType_; //!< The duration type of the Pickup. 184 178 185 179 //! Strings for the activation and duration types. -
code/branches/cpp11_v2/src/modules/pickup/items/DronePickup.cc
r10765 r10998 74 74 { 75 75 this->addTarget(ClassIdentifier<Pawn>::getIdentifier()); 76 this->setDurationType( pickupDurationType::once);76 this->setDurationType(PickupDurationType::once); 77 77 this->droneTemplate_ = ""; 78 78 } -
code/branches/cpp11_v2/src/modules/pickup/items/HealthPickup.cc
r10765 r10998 77 77 this->health_ = 0.0f; 78 78 this->healthRate_ = 0.0f; 79 this->healthType_ = pickupHealthType::limited;79 this->healthType_ = PickupHealthType::limited; 80 80 this->maxHealthSave_ = 0.0f; 81 81 this->maxHealthOverwrite_ = 0.0f; … … 127 127 switch(this->getHealthType()) 128 128 { 129 case pickupHealthType::permanent:129 case PickupHealthType::permanent: 130 130 if(pawn->getMaxHealth() < fullHealth) 131 131 pawn->setMaxHealth(fullHealth); 132 case pickupHealthType::limited:132 case PickupHealthType::limited: 133 133 pawn->addHealth(health); 134 134 break; 135 case pickupHealthType::temporary:135 case PickupHealthType::temporary: 136 136 if(pawn->getMaxHealth() > fullHealth) 137 137 { … … 174 174 switch(this->getHealthType()) 175 175 { 176 case pickupHealthType::permanent:176 case PickupHealthType::permanent: 177 177 health = pawn->getHealth()+this->getHealth(); 178 178 if(pawn->getMaxHealth() < health) 179 179 pawn->setMaxHealth(health); 180 case pickupHealthType::limited:180 case PickupHealthType::limited: 181 181 pawn->addHealth(this->getHealth()); 182 182 break; 183 case pickupHealthType::temporary:183 case PickupHealthType::temporary: 184 184 health = pawn->getHealth()+this->getHealth(); 185 185 if(pawn->getMaxHealth() < health) … … 201 201 else 202 202 { 203 if(this->getHealthType() == pickupHealthType::temporary)203 if(this->getHealthType() == PickupHealthType::temporary) 204 204 { 205 205 PickupCarrier* carrier = this->getCarrier(); … … 256 256 switch(this->getHealthType()) 257 257 { 258 case pickupHealthType::limited:258 case PickupHealthType::limited: 259 259 return HealthPickup::healthTypeLimited_s; 260 case pickupHealthType::temporary:260 case PickupHealthType::temporary: 261 261 return HealthPickup::healthTypeTemporary_s; 262 case pickupHealthType::permanent:262 case PickupHealthType::permanent: 263 263 return HealthPickup::healthTypePermanent_s; 264 264 default: … … 308 308 { 309 309 if(type == HealthPickup::healthTypeLimited_s) 310 this->setHealthType( pickupHealthType::limited);310 this->setHealthType(PickupHealthType::limited); 311 311 else if(type == HealthPickup::healthTypeTemporary_s) 312 this->setHealthType( pickupHealthType::temporary);312 this->setHealthType(PickupHealthType::temporary); 313 313 else if(type == HealthPickup::healthTypePermanent_s) 314 this->setHealthType( pickupHealthType::permanent);314 this->setHealthType(PickupHealthType::permanent); 315 315 else 316 316 orxout(internal_error, context::pickups) << "Invalid healthType '" << type << "' in HealthPickup." << endl; -
code/branches/cpp11_v2/src/modules/pickup/items/HealthPickup.h
r9667 r10998 51 51 @ingroup PickupItems 52 52 */ 53 namespace pickupHealthType53 enum class PickupHealthType 54 54 { 55 enum Value 56 { 57 limited, //!< Means that the @ref orxonox::HealthPickup "HealthPickup" only increases the users health to its maximum health. 58 temporary, //!< Means that the @ref orxonox::HealthPickup "HealthPickup" temporarily increases the users health even above its maximum health, but only as long as it is in use. 59 permanent //!< Means that the @ref orxonox::HealthPickup "HealthPickup" increases the users health even above its maximum health and increases the maximum health permanently such that it matches the new health. 60 }; 61 } 55 limited, //!< Means that the @ref orxonox::HealthPickup "HealthPickup" only increases the users health to its maximum health. 56 temporary, //!< Means that the @ref orxonox::HealthPickup "HealthPickup" temporarily increases the users health even above its maximum health, but only as long as it is in use. 57 permanent //!< Means that the @ref orxonox::HealthPickup "HealthPickup" increases the users health even above its maximum health and increases the maximum health permanently such that it matches the new health. 58 }; 62 59 63 60 /** … … 115 112 @return Returns the health type as an enum. 116 113 */ 117 inline pickupHealthType::Value getHealthType(void) const114 inline PickupHealthType getHealthType(void) const 118 115 { return this->healthType_; } 119 116 const std::string& getHealthTypeAsString(void) const; //!< Get the health type of this pickup. … … 127 124 @param type The type of this pickup as an enum. 128 125 */ 129 inline void setHealthType( pickupHealthType::Value type)126 inline void setHealthType(PickupHealthType type) 130 127 { this->healthType_ = type; } 131 128 void setHealthTypeAsString(const std::string& type); //!< Set the type of the HealthPickup. … … 139 136 float maxHealthSave_; //!< Helper to remember what the actual maxHealth of the Pawn was before we changed it. 140 137 float maxHealthOverwrite_; //!< Helper to remember with which value we overwrote the maxHealh, to detect if someone else changed it as well. 141 pickupHealthType::Value healthType_; //!< The type of the HealthPickup.138 PickupHealthType healthType_; //!< The type of the HealthPickup. 142 139 143 140 //! Strings for the health types. -
code/branches/cpp11_v2/src/modules/pickup/items/MetaPickup.cc
r10916 r10998 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 != nullptr)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); … … 124 124 125 125 // If the metaType is use, then the Pickupable is set to used. 126 if(this->getMetaType() == pickupMetaType::use && !pickup->isUsed())126 if(this->getMetaType() == PickupMetaType::use && !pickup->isUsed()) 127 127 { 128 128 pickup->setUsed(true); 129 129 } 130 130 // If the metaType is drop, then the Pickupable is dropped. 131 else if(this->getMetaType() == pickupMetaType::drop)131 else if(this->getMetaType() == PickupMetaType::drop) 132 132 { 133 133 pickup->drop(); 134 134 } 135 135 // If the metaType is destroy, then the Pickupable is destroyed. 136 else if(this->getMetaType() == pickupMetaType::destroy)136 else if(this->getMetaType() == PickupMetaType::destroy) 137 137 { 138 138 pickup->Pickupable::destroy(); … … 154 154 switch(this->getMetaType()) 155 155 { 156 case pickupMetaType::none:156 case PickupMetaType::none: 157 157 return MetaPickup::metaTypeNone_s; 158 case pickupMetaType::use:158 case PickupMetaType::use: 159 159 return MetaPickup::metaTypeUse_s; 160 case pickupMetaType::drop:160 case PickupMetaType::drop: 161 161 return MetaPickup::metaTypeDrop_s; 162 case pickupMetaType::destroy:162 case PickupMetaType::destroy: 163 163 return MetaPickup::metaTypeDestroy_s; 164 case pickupMetaType::destroyCarrier:164 case PickupMetaType::destroyCarrier: 165 165 return MetaPickup::metaTypeDestroyCarrier_s; 166 166 default: … … 179 179 if(type == MetaPickup::metaTypeNone_s) 180 180 { 181 this->setMetaType( pickupMetaType::none);181 this->setMetaType(PickupMetaType::none); 182 182 } 183 183 else if(type == MetaPickup::metaTypeUse_s) 184 184 { 185 this->setMetaType( pickupMetaType::use);185 this->setMetaType(PickupMetaType::use); 186 186 } 187 187 else if(type == MetaPickup::metaTypeDrop_s) 188 188 { 189 this->setMetaType( pickupMetaType::drop);189 this->setMetaType(PickupMetaType::drop); 190 190 } 191 191 else if(type == MetaPickup::metaTypeDestroy_s) 192 192 { 193 this->setMetaType( pickupMetaType::destroy);193 this->setMetaType(PickupMetaType::destroy); 194 194 } 195 195 else if(type == MetaPickup::metaTypeDestroyCarrier_s) 196 196 { 197 this->setMetaType( pickupMetaType::destroyCarrier);197 this->setMetaType(PickupMetaType::destroyCarrier); 198 198 } 199 199 else -
code/branches/cpp11_v2/src/modules/pickup/items/MetaPickup.h
r9667 r10998 48 48 @ingroup PickupItems 49 49 */ 50 namespace pickupMetaType50 enum class PickupMetaType 51 51 { 52 enum Value 53 { 54 none, //!< The @ref orxonox::MetaPickup "MetaPickup" does nothing. 55 use, //!< The @ref orxonox::MetaPickup "MetaPickup" uses all the @ref orxonox::PickupCarrier "PickupCarriers'" @ref orxonox::Pickupable "Pickupables". 56 drop, //!< The @ref orxonox::MetaPickup "MetaPickup" drops all the @ref orxonox::PickupCarrier "PickupCarriers'" @ref orxonox::Pickupable "Pickupables". 57 destroy, //!< The @ref orxonox::MetaPickup "MetaPickup" destroys all the @ref orxonox::PickupCarrier "PickupCarriers'" @ref orxonox::Pickupable "Pickupables". 58 destroyCarrier //!< The @ref orxonox::MetaPickup "MetaPickup" destroys the @ref orxonox::PickupCarrier "PickupCarrier". 59 }; 60 } 52 none, //!< The @ref orxonox::MetaPickup "MetaPickup" does nothing. 53 use, //!< The @ref orxonox::MetaPickup "MetaPickup" uses all the @ref orxonox::PickupCarrier "PickupCarriers'" @ref orxonox::Pickupable "Pickupables". 54 drop, //!< The @ref orxonox::MetaPickup "MetaPickup" drops all the @ref orxonox::PickupCarrier "PickupCarriers'" @ref orxonox::Pickupable "Pickupables". 55 destroy, //!< The @ref orxonox::MetaPickup "MetaPickup" destroys all the @ref orxonox::PickupCarrier "PickupCarriers'" @ref orxonox::Pickupable "Pickupables". 56 destroyCarrier //!< The @ref orxonox::MetaPickup "MetaPickup" destroys the @ref orxonox::PickupCarrier "PickupCarrier". 57 }; 61 58 62 59 /** … … 100 97 @return Returns an enum with the meta type of the MetaPickup. 101 98 */ 102 inline pickupMetaType::Value getMetaType(void) const99 inline PickupMetaType getMetaType(void) const 103 100 { return this->metaType_; } 104 101 const std::string& getMetaTypeAsString(void) const; //!< Get the meta type of this MetaPickup. … … 109 106 @param type The meta type as an enum. 110 107 */ 111 inline void setMetaType( pickupMetaType::Value type)108 inline void setMetaType(PickupMetaType type) 112 109 { this->metaType_ = type; } 113 110 void setMetaTypeAsString(const std::string& type); //!< Set the meta type of this MetaPickup. … … 116 113 void initialize(void); //!< Initializes the member variables. 117 114 118 pickupMetaType::Value metaType_; //!< The meta type of the MetaPickup, determines which actions are taken.115 PickupMetaType metaType_; //!< The meta type of the MetaPickup, determines which actions are taken. 119 116 120 117 //! Static strings for the meta types.
Note: See TracChangeset
for help on using the changeset viewer.