Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10998 for code


Ignore:
Timestamp:
Dec 30, 2015, 1:59:38 PM (9 years ago)
Author:
landauf
Message:

using strongly typed enum class in pickups and triggers.

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  
    5858
    5959        this->distance_ = 100.0f;
    60         this->setBeaconModeDirect(distanceMultiTriggerBeaconMode::off);
     60        this->setBeaconModeDirect(DistanceMultiTriggerBeaconMode::off);
    6161        this->targetName_ = "";
    6262        this->beaconMask_.exclude(Class(BaseObject));
     
    136136        ClassTreeMask targetMask = this->getTargetMask();
    137137        // 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)
    139139            targetMask = this->beaconMask_;
    140140
     
    145145
    146146            // 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)
    148148            {
    149149                if(entity->getName() != this->targetName_)
     
    155155           
    156156            // 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)
    158158            {
    159159               
     
    182182
    183183                // 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)
    185185                    entity = entity->getParent();
    186186
     
    206206        The mode as an enum.
    207207    */
    208     void DistanceMultiTrigger::setBeaconModeDirect(distanceMultiTriggerBeaconMode::Value mode)
     208    void DistanceMultiTrigger::setBeaconModeDirect(DistanceMultiTriggerBeaconMode mode)
    209209    {
    210210        this->beaconMode_ = mode;
     
    221221        switch(this->getBeaconModeDirect())
    222222        {
    223             case distanceMultiTriggerBeaconMode::off :
     223            case DistanceMultiTriggerBeaconMode::off :
    224224                return DistanceMultiTrigger::beaconModeOff_s;
    225             case distanceMultiTriggerBeaconMode::identify:
     225            case DistanceMultiTriggerBeaconMode::identify:
    226226                return DistanceMultiTrigger::beaconModeIdentify_s;
    227             case distanceMultiTriggerBeaconMode::exclude:
     227            case DistanceMultiTriggerBeaconMode::exclude:
    228228                return DistanceMultiTrigger::beaconModeExlcude_s;
    229229            default :
     
    242242    {
    243243        if(mode == DistanceMultiTrigger::beaconModeOff_s)
    244             this->setBeaconModeDirect(distanceMultiTriggerBeaconMode::off);
     244            this->setBeaconModeDirect(DistanceMultiTriggerBeaconMode::off);
    245245        else if(mode == DistanceMultiTrigger::beaconModeIdentify_s)
    246             this->setBeaconModeDirect(distanceMultiTriggerBeaconMode::identify);
     246            this->setBeaconModeDirect(DistanceMultiTriggerBeaconMode::identify);
    247247        else if(mode == DistanceMultiTrigger::beaconModeExlcude_s)
    248             this->setBeaconModeDirect(distanceMultiTriggerBeaconMode::exclude);
     248            this->setBeaconModeDirect(DistanceMultiTriggerBeaconMode::exclude);
    249249        else
    250250            orxout(internal_error, context::triggers) << "Invalid beacon mode in DistanceMultiTrigger." << endl;
  • code/branches/cpp11_v2/src/modules/objects/triggers/DistanceMultiTrigger.h

    r10769 r10998  
    5555    @ingroup MultiTrigger
    5656    */
    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    };
    6562
    6663    /**
     
    113110                { return this->distance_; }
    114111           
    115             void setBeaconModeDirect(distanceMultiTriggerBeaconMode::Value mode); // Set the beacon mode.
     112            void setBeaconModeDirect(DistanceMultiTriggerBeaconMode mode); // Set the beacon mode.
    116113            /**
    117114            @brief Get the beacon mode.
    118115            @return Returns the mode as an enum.
    119116            */
    120             inline distanceMultiTriggerBeaconMode::Value getBeaconModeDirect(void) const
     117            inline DistanceMultiTriggerBeaconMode getBeaconModeDirect(void) const
    121118                { return this->beaconMode_; }
    122119            void setBeaconMode(const std::string& mode); // Set the beacon mode.
     
    149146            float distance_; //!< The distance at which the DistanceMultiTrigger triggers.
    150147
    151             distanceMultiTriggerBeaconMode::Value beaconMode_; //!< The beacon mode, the DistanceMultiTrigger is in.
     148            DistanceMultiTriggerBeaconMode beaconMode_; //!< The beacon mode, the DistanceMultiTrigger is in.
    152149            std::string targetName_; //!< The target name, used in <em>single-target</em> mode.
    153150            ClassTreeMask beaconMask_; //!< A mask, that only accepts DistanceTriggerBeacons.
  • code/branches/cpp11_v2/src/modules/objects/triggers/DistanceTrigger.cc

    r10916 r10998  
    158158        ClassTreeMask targetMask = this->targetMask_;
    159159        // 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)
    161161            targetMask = this->beaconMask_;
    162162
     
    167167
    168168            // 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)
    170170            {
    171171                if(entity->getName() != this->targetName_)
     
    177177
    178178            // 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)
    180180            {
    181181
     
    202202                {
    203203                    // 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)
    205205                        entity = entity->getParent();
    206206
     
    228228        The mode as an enum.
    229229    */
    230     void DistanceTrigger::setBeaconModeDirect(distanceTriggerBeaconMode::Value mode)
     230    void DistanceTrigger::setBeaconModeDirect(DistanceTriggerBeaconMode mode)
    231231    {
    232232        this->beaconMode_ = mode;
     
    243243        switch(this->getBeaconModeDirect())
    244244        {
    245             case distanceTriggerBeaconMode::off :
     245            case DistanceTriggerBeaconMode::off :
    246246                return DistanceTrigger::beaconModeOff_s;
    247             case distanceTriggerBeaconMode::identify:
     247            case DistanceTriggerBeaconMode::identify:
    248248                return DistanceTrigger::beaconModeIdentify_s;
    249             case distanceTriggerBeaconMode::exclude:
     249            case DistanceTriggerBeaconMode::exclude:
    250250                return DistanceTrigger::beaconModeExlcude_s;
    251251            default :
     
    264264    {
    265265        if(mode == DistanceTrigger::beaconModeOff_s)
    266             this->setBeaconModeDirect(distanceTriggerBeaconMode::off);
     266            this->setBeaconModeDirect(DistanceTriggerBeaconMode::off);
    267267        else if(mode == DistanceTrigger::beaconModeIdentify_s)
    268             this->setBeaconModeDirect(distanceTriggerBeaconMode::identify);
     268            this->setBeaconModeDirect(DistanceTriggerBeaconMode::identify);
    269269        else if(mode == DistanceTrigger::beaconModeExlcude_s)
    270             this->setBeaconModeDirect(distanceTriggerBeaconMode::exclude);
     270            this->setBeaconModeDirect(DistanceTriggerBeaconMode::exclude);
    271271        else
    272272            orxout(internal_error, context::triggers) << "Invalid beacon mode in DistanceTrigger." << endl;
     
    282282        Returns true if it is triggered ,false if not.
    283283    */
    284     bool DistanceTrigger::isTriggered(TriggerMode::Value mode)
     284    bool DistanceTrigger::isTriggered(TriggerMode mode)
    285285    {
    286286        if (Trigger::isTriggered(mode))
  • code/branches/cpp11_v2/src/modules/objects/triggers/DistanceTrigger.h

    r9667 r10998  
    5555  @ingroup NormalTrigger
    5656  */
    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  };
    6562
    6663    /**
     
    118115                { return this->distance_; }
    119116
    120             void setBeaconModeDirect(distanceTriggerBeaconMode::Value mode); // Set the beacon mode.
     117            void setBeaconModeDirect(DistanceTriggerBeaconMode mode); // Set the beacon mode.
    121118            /**
    122119            @brief Get the beacon mode.
    123120            @return Returns the mode as an enum.
    124121            */
    125             inline distanceTriggerBeaconMode::Value getBeaconModeDirect(void) const
     122            inline DistanceTriggerBeaconMode getBeaconModeDirect(void) const
    126123            { return this->beaconMode_; }
    127124            void setBeaconMode(const std::string& mode); // Set the beacon mode.
     
    144141
    145142        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.
    147144            /**
    148145            @brief Notifies interested parties about a change of the DistanceTrigger's target mask.
     
    160157            float distance_; //!< The range of the DistanceTrigger.
    161158           
    162             distanceTriggerBeaconMode::Value beaconMode_; //!< The beacon mode.
     159            DistanceTriggerBeaconMode beaconMode_; //!< The beacon mode.
    163160            std::string targetName_; //!< The name a DistanceTriggerBeacon needs to have to make the DistanceTrigger react to it if in beacon-mode.
    164161            ClassTreeMask beaconMask_; //!< A mask, that only accepts DistanceTriggerBeacons.
  • code/branches/cpp11_v2/src/modules/objects/triggers/EventTrigger.cc

    r9667 r10998  
    7979        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.
    8080    */
    81     bool EventTrigger::isTriggered(TriggerMode::Value mode)
     81    bool EventTrigger::isTriggered(TriggerMode mode)
    8282    {
    8383        if (Trigger::isTriggered(mode))
  • code/branches/cpp11_v2/src/modules/objects/triggers/EventTrigger.h

    r9667 r10998  
    8484
    8585        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.
    8787
    8888        private:
  • code/branches/cpp11_v2/src/modules/objects/triggers/Trigger.cc

    r10919 r10998  
    203203        Returns true if the Trigger should be triggered and false if not.
    204204    */
    205     bool Trigger::isTriggered(TriggerMode::Value mode)
     205    bool Trigger::isTriggered(TriggerMode mode)
    206206    {
    207207        // If the trigger has sub-triggers.
  • code/branches/cpp11_v2/src/modules/objects/triggers/Trigger.h

    r10769 r10998  
    105105            inline bool isTriggered()
    106106                { return this->isTriggered(this->mode_); }
    107             virtual bool isTriggered(TriggerMode::Value mode); // 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.
    108108            virtual void triggered(bool bIsTriggered); // Fires an event with the input triggered state.
    109109
  • code/branches/cpp11_v2/src/modules/objects/triggers/TriggerBase.h

    r9667 r10998  
    5252    @ingroup Triggers
    5353    */
    54     namespace TriggerMode
     54    enum class TriggerMode
    5555    {
    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    };
    6360
    6461    /**
     
    158155            @param mode The mode of the trigger.
    159156            */
    160             inline void setMode(TriggerMode::Value mode) //!< Get the mode of the trigger.
     157            inline void setMode(TriggerMode mode) //!< Get the mode of the trigger.
    161158                { this->mode_ = mode; }
    162159            const std::string& getModeString(void) const;
     
    165162            @return Returns and Enum for the mode of the trigger.
    166163            */
    167             inline TriggerMode::Value getMode(void) const
     164            inline TriggerMode getMode(void) const
    168165                { return mode_; }
    169166
     
    211208
    212209            bool bInvertMode_; //!< Bool for the invert-mode, if true the trigger is inverted.
    213             TriggerMode::Value mode_; //!< The mode of the trigger.
     210            TriggerMode mode_; //!< The mode of the trigger.
    214211
    215212            TriggerBase* parent_; //!< The parent of this trigger.
  • code/branches/cpp11_v2/src/modules/pickup/Pickup.cc

    r9667 r10998  
    7878    void Pickup::initialize(void)
    7979    {
    80         this->activationType_ = pickupActivationType::immediate;
    81         this->durationType_ = pickupDurationType::once;
     80        this->activationType_ = PickupActivationType::immediate;
     81        this->durationType_ = PickupDurationType::once;
    8282    }
    8383
     
    105105        switch(this->getActivationType())
    106106        {
    107             case pickupActivationType::immediate:
     107            case PickupActivationType::immediate:
    108108                return activationTypeImmediate_s;
    109             case pickupActivationType::onUse:
     109            case PickupActivationType::onUse:
    110110                return activationTypeOnUse_s;
    111111            default:
     
    124124        switch(this->getDurationType())
    125125        {
    126             case pickupDurationType::once:
     126            case PickupDurationType::once:
    127127                return durationTypeOnce_s;
    128             case pickupDurationType::continuous:
     128            case PickupDurationType::continuous:
    129129                return durationTypeContinuous_s;
    130130            default:
     
    142142    {
    143143        if(type == Pickup::activationTypeImmediate_s)
    144             this->setActivationType(pickupActivationType::immediate);
     144            this->setActivationType(PickupActivationType::immediate);
    145145        else if(type == Pickup::activationTypeOnUse_s)
    146             this->setActivationType(pickupActivationType::onUse);
     146            this->setActivationType(PickupActivationType::onUse);
    147147        else
    148148            orxout(internal_error, context::pickups) << "Invalid activationType '" << type << "' in " << this->getIdentifier()->getName() << "." << endl;
     
    158158    {
    159159        if(type == Pickup::durationTypeOnce_s)
    160             this->setDurationType(pickupDurationType::once);
     160            this->setDurationType(PickupDurationType::once);
    161161        else if(type == Pickup::durationTypeContinuous_s)
    162             this->setDurationType(pickupDurationType::continuous);
     162            this->setDurationType(PickupDurationType::continuous);
    163163        else
    164164            orxout(internal_error, context::pickups) << "Invalid durationType '" << type << "' in " << this->getIdentifier()->getName() << "." << endl;
  • code/branches/cpp11_v2/src/modules/pickup/Pickup.h

    r10817 r10998  
    5353    @ingroup Pickup
    5454    */
    55     namespace pickupActivationType
     55    enum class PickupActivationType
    5656    {
    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    };
    6360
    6461    /**
     
    6865    @ingroup Pickup
    6966    */
    70     namespace pickupDurationType
     67    enum class PickupDurationType
    7168    {
    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    };
    7872
    7973    /**
     
    112106            @return Returns the activation type of the Pickup.
    113107            */
    114             inline pickupActivationType::Value getActivationType(void) const
     108            inline PickupActivationType getActivationType(void) const
    115109                { return this->activationType_; }
    116110            /**
     
    118112            @return Returns the duration type of the Pickup.
    119113            */
    120             inline pickupDurationType::Value getDurationType(void) const
     114            inline PickupDurationType getDurationType(void) const
    121115                { return this->durationType_; }
    122116
     
    129123            */
    130124            inline bool isImmediate(void) const
    131                 { return this->getActivationType() == pickupActivationType::immediate; }
     125                { return this->getActivationType() == PickupActivationType::immediate; }
    132126            /**
    133127            @brief Get whether the activation type is 'onUse'.
     
    135129            */
    136130            inline bool isOnUse(void) const
    137                 { return this->getActivationType() == pickupActivationType::onUse; }
     131                { return this->getActivationType() == PickupActivationType::onUse; }
    138132            /**
    139133            @brief Get whether the duration type is 'once'.
     
    141135            */
    142136            inline bool isOnce(void) const
    143                 { return this->getDurationType() == pickupDurationType::once; }
     137                { return this->getDurationType() == PickupDurationType::once; }
    144138            /**
    145139            @brief Get whether the duration type is 'continuous'.
     
    147141            */
    148142            inline bool isContinuous(void) const
    149                 { return this->getDurationType() == pickupDurationType::continuous; }
     143                { return this->getDurationType() == PickupDurationType::continuous; }
    150144
    151145            virtual void changedPickedUp(void) override; //!< Should be called when the pickup has transited from picked up to dropped or the other way around.
     
    164158            @param type The activation type of the Pickup.
    165159            */
    166             inline void setActivationType(pickupActivationType::Value type)
     160            inline void setActivationType(PickupActivationType type)
    167161                { this->activationType_ = type; }
    168162            /**
     
    170164            @param type The duration type of the Pickup.
    171165            */
    172             inline void setDurationType(pickupDurationType::Value type)
     166            inline void setDurationType(PickupDurationType type)
    173167                { this->durationType_ = type; }
    174168
     
    180174
    181175            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.
    184178
    185179            //! Strings for the activation and duration types.
  • code/branches/cpp11_v2/src/modules/pickup/items/DronePickup.cc

    r10765 r10998  
    7474    {
    7575        this->addTarget(ClassIdentifier<Pawn>::getIdentifier());
    76         this->setDurationType(pickupDurationType::once);
     76        this->setDurationType(PickupDurationType::once);
    7777        this->droneTemplate_ = "";
    7878    }
  • code/branches/cpp11_v2/src/modules/pickup/items/HealthPickup.cc

    r10765 r10998  
    7777        this->health_ = 0.0f;
    7878        this->healthRate_ = 0.0f;
    79         this->healthType_ = pickupHealthType::limited;
     79        this->healthType_ = PickupHealthType::limited;
    8080        this->maxHealthSave_ = 0.0f;
    8181        this->maxHealthOverwrite_ = 0.0f;
     
    127127            switch(this->getHealthType())
    128128            {
    129                 case pickupHealthType::permanent:
     129                case PickupHealthType::permanent:
    130130                    if(pawn->getMaxHealth() < fullHealth)
    131131                        pawn->setMaxHealth(fullHealth);
    132                 case pickupHealthType::limited:
     132                case PickupHealthType::limited:
    133133                    pawn->addHealth(health);
    134134                    break;
    135                 case pickupHealthType::temporary:
     135                case PickupHealthType::temporary:
    136136                    if(pawn->getMaxHealth() > fullHealth)
    137137                    {
     
    174174                switch(this->getHealthType())
    175175                {
    176                     case pickupHealthType::permanent:
     176                    case PickupHealthType::permanent:
    177177                        health = pawn->getHealth()+this->getHealth();
    178178                        if(pawn->getMaxHealth() < health)
    179179                            pawn->setMaxHealth(health);
    180                     case pickupHealthType::limited:
     180                    case PickupHealthType::limited:
    181181                        pawn->addHealth(this->getHealth());
    182182                        break;
    183                     case pickupHealthType::temporary:
     183                    case PickupHealthType::temporary:
    184184                        health = pawn->getHealth()+this->getHealth();
    185185                        if(pawn->getMaxHealth() < health)
     
    201201        else
    202202        {
    203             if(this->getHealthType() == pickupHealthType::temporary)
     203            if(this->getHealthType() == PickupHealthType::temporary)
    204204            {
    205205                PickupCarrier* carrier = this->getCarrier();
     
    256256        switch(this->getHealthType())
    257257        {
    258             case pickupHealthType::limited:
     258            case PickupHealthType::limited:
    259259                return HealthPickup::healthTypeLimited_s;
    260             case pickupHealthType::temporary:
     260            case PickupHealthType::temporary:
    261261                return HealthPickup::healthTypeTemporary_s;
    262             case pickupHealthType::permanent:
     262            case PickupHealthType::permanent:
    263263                return HealthPickup::healthTypePermanent_s;
    264264            default:
     
    308308    {
    309309        if(type == HealthPickup::healthTypeLimited_s)
    310             this->setHealthType(pickupHealthType::limited);
     310            this->setHealthType(PickupHealthType::limited);
    311311        else if(type == HealthPickup::healthTypeTemporary_s)
    312             this->setHealthType(pickupHealthType::temporary);
     312            this->setHealthType(PickupHealthType::temporary);
    313313        else if(type == HealthPickup::healthTypePermanent_s)
    314             this->setHealthType(pickupHealthType::permanent);
     314            this->setHealthType(PickupHealthType::permanent);
    315315        else
    316316            orxout(internal_error, context::pickups) << "Invalid healthType '" << type << "' in HealthPickup." << endl;
  • code/branches/cpp11_v2/src/modules/pickup/items/HealthPickup.h

    r9667 r10998  
    5151    @ingroup PickupItems
    5252    */
    53     namespace pickupHealthType
     53    enum class PickupHealthType
    5454    {
    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    };
    6259
    6360    /**
     
    115112            @return Returns the health type as an enum.
    116113            */
    117             inline pickupHealthType::Value getHealthType(void) const
     114            inline PickupHealthType getHealthType(void) const
    118115                { return this->healthType_; }
    119116            const std::string& getHealthTypeAsString(void) const; //!< Get the health type of this pickup.
     
    127124            @param type The type of this pickup as an enum.
    128125            */
    129             inline void setHealthType(pickupHealthType::Value type)
     126            inline void setHealthType(PickupHealthType type)
    130127                { this->healthType_ = type; }
    131128            void setHealthTypeAsString(const std::string& type); //!< Set the type of the HealthPickup.
     
    139136            float maxHealthSave_; //!< Helper to remember what the actual maxHealth of the Pawn was before we changed it.
    140137            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.
    142139
    143140            //! Strings for the health types.
  • code/branches/cpp11_v2/src/modules/pickup/items/MetaPickup.cc

    r10916 r10998  
    7979        this->addTarget(ClassIdentifier<PickupCarrier>::getIdentifier());
    8080
    81         this->setDurationType(pickupDurationType::once);
    82         this->metaType_ = pickupMetaType::none;
     81        this->setDurationType(PickupDurationType::once);
     82        this->metaType_ = PickupMetaType::none;
    8383    }
    8484
     
    104104
    105105        // 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)
    107107        {
    108108            PickupCarrier* carrier = this->getCarrier();
    109             if(this->getMetaType() != pickupMetaType::none && carrier != nullptr)
     109            if(this->getMetaType() != PickupMetaType::none && carrier != nullptr)
    110110            {
    111111                // If the metaType is destroyCarrier, then the PickupCarrier is destroyed.
    112                 if(this->getMetaType() == pickupMetaType::destroyCarrier)
     112                if(this->getMetaType() == PickupMetaType::destroyCarrier)
    113113                {
    114114                    Pawn* pawn = orxonox_cast<Pawn*>(carrier);
     
    124124
    125125                    // 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())
    127127                    {
    128128                        pickup->setUsed(true);
    129129                    }
    130130                    // If the metaType is drop, then the Pickupable is dropped.
    131                     else if(this->getMetaType() == pickupMetaType::drop)
     131                    else if(this->getMetaType() == PickupMetaType::drop)
    132132                    {
    133133                        pickup->drop();
    134134                    }
    135135                    // If the metaType is destroy, then the Pickupable is destroyed.
    136                     else if(this->getMetaType() == pickupMetaType::destroy)
     136                    else if(this->getMetaType() == PickupMetaType::destroy)
    137137                    {
    138138                        pickup->Pickupable::destroy();
     
    154154        switch(this->getMetaType())
    155155        {
    156             case pickupMetaType::none:
     156            case PickupMetaType::none:
    157157                return MetaPickup::metaTypeNone_s;
    158             case pickupMetaType::use:
     158            case PickupMetaType::use:
    159159                return MetaPickup::metaTypeUse_s;
    160             case pickupMetaType::drop:
     160            case PickupMetaType::drop:
    161161                return MetaPickup::metaTypeDrop_s;
    162             case pickupMetaType::destroy:
     162            case PickupMetaType::destroy:
    163163                return MetaPickup::metaTypeDestroy_s;
    164             case pickupMetaType::destroyCarrier:
     164            case PickupMetaType::destroyCarrier:
    165165                return MetaPickup::metaTypeDestroyCarrier_s;
    166166            default:
     
    179179        if(type == MetaPickup::metaTypeNone_s)
    180180        {
    181             this->setMetaType(pickupMetaType::none);
     181            this->setMetaType(PickupMetaType::none);
    182182        }
    183183        else if(type == MetaPickup::metaTypeUse_s)
    184184        {
    185             this->setMetaType(pickupMetaType::use);
     185            this->setMetaType(PickupMetaType::use);
    186186        }
    187187        else if(type == MetaPickup::metaTypeDrop_s)
    188188        {
    189             this->setMetaType(pickupMetaType::drop);
     189            this->setMetaType(PickupMetaType::drop);
    190190        }
    191191        else if(type == MetaPickup::metaTypeDestroy_s)
    192192        {
    193             this->setMetaType(pickupMetaType::destroy);
     193            this->setMetaType(PickupMetaType::destroy);
    194194        }
    195195        else if(type == MetaPickup::metaTypeDestroyCarrier_s)
    196196        {
    197             this->setMetaType(pickupMetaType::destroyCarrier);
     197            this->setMetaType(PickupMetaType::destroyCarrier);
    198198        }
    199199        else
  • code/branches/cpp11_v2/src/modules/pickup/items/MetaPickup.h

    r9667 r10998  
    4848    @ingroup PickupItems
    4949    */
    50     namespace pickupMetaType
     50    enum class PickupMetaType
    5151    {
    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    };
    6158
    6259    /**
     
    10097            @return Returns an enum with the meta type of the MetaPickup.
    10198            */
    102             inline pickupMetaType::Value getMetaType(void) const
     99            inline PickupMetaType getMetaType(void) const
    103100                { return this->metaType_; }
    104101            const std::string& getMetaTypeAsString(void) const; //!< Get the meta type of this MetaPickup.
     
    109106            @param type The meta type as an enum.
    110107            */
    111             inline void setMetaType(pickupMetaType::Value type)
     108            inline void setMetaType(PickupMetaType type)
    112109                { this->metaType_ =  type; }
    113110            void setMetaTypeAsString(const std::string& type); //!< Set the meta type of this MetaPickup.
     
    116113            void initialize(void); //!< Initializes the member variables.
    117114
    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.
    119116
    120117            //! Static strings for the meta types.
Note: See TracChangeset for help on using the changeset viewer.