Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 30, 2009, 3:14:45 PM (16 years ago)
Author:
rgrieder
Message:

Unified enumeration layout according to the style guide (which I have edited recently ;)).
There is one exception though: XMLPort::Mode. Since that would involve 182 changed files, I have decided not to rename it for now. Moreover its syntax is not too bad ;)

Location:
code/branches/core4/src/orxonox/objects/pickup
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core4/src/orxonox/objects/pickup/ModifierPickup.cc

    r3196 r3257  
    8787        if (this->addTo(pawn))
    8888        {
    89             std::map<ModifierType::Enum, float>::iterator it;
     89            std::map<ModifierType::Value, float>::iterator it;
    9090
    9191            for (it = this->additiveModifiers_.begin(); it != this->additiveModifiers_.end(); it++)
     
    124124        if (this->removeFrom(pawn))
    125125        {
    126             std::map<ModifierType::Enum, float>::iterator it;
     126            std::map<ModifierType::Value, float>::iterator it;
    127127
    128128            for (it = this->additiveModifiers_.begin(); it != this->additiveModifiers_.end(); it++)
     
    158158        @return Returns the additive modifier for type (or 0 if not exists).
    159159    */
    160     float ModifierPickup::getAdditiveModifier(ModifierType::Enum type) const
    161     {
    162         std::map<ModifierType::Enum, float>::const_iterator it = this->additiveModifiers_.find(type);
     160    float ModifierPickup::getAdditiveModifier(ModifierType::Value type) const
     161    {
     162        std::map<ModifierType::Value, float>::const_iterator it = this->additiveModifiers_.find(type);
    163163        if (it != this->additiveModifiers_.end())
    164164            return (*it).second;
     
    171171        @return Returns the multiplicative modifier for type (or 1 if not exists).
    172172    */
    173     float ModifierPickup::getMultiplicativeModifier(ModifierType::Enum type) const
    174     {
    175         std::map<ModifierType::Enum, float>::const_iterator it = this->multiplicativeModifiers_.find(type);
     173    float ModifierPickup::getMultiplicativeModifier(ModifierType::Value type) const
     174    {
     175        std::map<ModifierType::Value, float>::const_iterator it = this->multiplicativeModifiers_.find(type);
    176176        if (it != this->multiplicativeModifiers_.end())
    177177            return (*it).second;
     
    184184        @param value The new additive modifier for type.
    185185    */
    186     void ModifierPickup::setAdditiveModifier(ModifierType::Enum type, float value)
     186    void ModifierPickup::setAdditiveModifier(ModifierType::Value type, float value)
    187187    {
    188188        if (this->additiveModifiers_.find(type) == this->additiveModifiers_.end())
    189             this->additiveModifiers_.insert( std::pair<ModifierType::Enum, float>(type, value) );
     189            this->additiveModifiers_.insert( std::pair<ModifierType::Value, float>(type, value) );
    190190        else
    191191            this->additiveModifiers_[type] = value;
     
    196196        @param value The new multiplicative modifier for type.
    197197    */
    198     void ModifierPickup::setMultiplicativeModifier(ModifierType::Enum type, float value)
     198    void ModifierPickup::setMultiplicativeModifier(ModifierType::Value type, float value)
    199199    {
    200200        if (this->multiplicativeModifiers_.find(type) == this->multiplicativeModifiers_.end())
    201             this->multiplicativeModifiers_.insert( std::pair<ModifierType::Enum, float>(type, value) );
     201            this->multiplicativeModifiers_.insert( std::pair<ModifierType::Value, float>(type, value) );
    202202        else
    203203            this->multiplicativeModifiers_[type] = value;
  • code/branches/core4/src/orxonox/objects/pickup/ModifierPickup.h

    r3196 r3257  
    130130        void timerCallback(Pawn* pawn);     //!< Method called when the timer runs out.
    131131    private:
    132         float getAdditiveModifier(ModifierType::Enum type) const;               //!< Get the additive modifier for a given ModifierType.
    133         float getMultiplicativeModifier(ModifierType::Enum type) const;         //!< Get the multiplicative modifier for a given ModifierType.
    134         void setAdditiveModifier(ModifierType::Enum type, float value);         //!< Set the additive modifier for a given ModifierType.
    135         void setMultiplicativeModifier(ModifierType::Enum type, float value);   //!< Set the multiplicative modifier for a given ModifierType
     132        float getAdditiveModifier(ModifierType::Value type) const;               //!< Get the additive modifier for a given ModifierType.
     133        float getMultiplicativeModifier(ModifierType::Value type) const;         //!< Get the multiplicative modifier for a given ModifierType.
     134        void setAdditiveModifier(ModifierType::Value type, float value);         //!< Set the additive modifier for a given ModifierType.
     135        void setMultiplicativeModifier(ModifierType::Value type, float value);   //!< Set the multiplicative modifier for a given ModifierType
    136136
    137         std::map<ModifierType::Enum, float> additiveModifiers_;                 //!< Map of additive modifiers, indexed by ModifierType.
    138         std::map<ModifierType::Enum, float> multiplicativeModifiers_;           //!< Map of multiplicative modifiers, indexed by ModifierType.
     137        std::map<ModifierType::Value, float> additiveModifiers_;                 //!< Map of additive modifiers, indexed by ModifierType.
     138        std::map<ModifierType::Value, float> multiplicativeModifiers_;           //!< Map of multiplicative modifiers, indexed by ModifierType.
    139139
    140140        float duration_;                                                        //!< Duration of this pickup's effect (0 for unlimited).
  • code/branches/core4/src/orxonox/objects/pickup/ModifierType.h

    r3196 r3257  
    4444            @brief Gives the available types for modifiers.
    4545        */
    46         enum Enum
     46        enum Value
    4747        {
    4848            Unknown = 0,
  • code/branches/core4/src/orxonox/objects/pickup/PickupCollection.cc

    r3239 r3257  
    4242{
    4343    typedef std::pair<std::multimap<std::string, BaseItem*>::iterator, std::multimap<std::string, BaseItem*>::iterator> item_range;
    44     typedef std::pair<std::multimap<ModifierType::Enum, float>::iterator, std::multimap<ModifierType::Enum, float>::iterator> modifier_range;
     44    typedef std::pair<std::multimap<ModifierType::Value, float>::iterator, std::multimap<ModifierType::Value, float>::iterator> modifier_range;
    4545
    4646    //! Constructor
     
    200200        @param value Value for the modifier.
    201201    */
    202     void PickupCollection::addAdditiveModifier(ModifierType::Enum type, float value)
    203     {
    204         this->additiveModifiers_.insert( std::pair<ModifierType::Enum, float>(type, value) );
     202    void PickupCollection::addAdditiveModifier(ModifierType::Value type, float value)
     203    {
     204        this->additiveModifiers_.insert( std::pair<ModifierType::Value, float>(type, value) );
    205205    }
    206206    /**
     
    209209        @return Returns the sum of the additive modifiers of the type.
    210210    */
    211     float PickupCollection::getAdditiveModifier(ModifierType::Enum type)
     211    float PickupCollection::getAdditiveModifier(ModifierType::Value type)
    212212    {
    213213        float v = 0.0f;
     
    215215        modifier_range range = this->additiveModifiers_.equal_range(type);
    216216
    217         for (std::multimap<ModifierType::Enum, float>::iterator it = range.first; it != range.second && it != this->additiveModifiers_.end(); it++)
     217        for (std::multimap<ModifierType::Value, float>::iterator it = range.first; it != range.second && it != this->additiveModifiers_.end(); it++)
    218218        {
    219219            v += (*it).second;
     
    227227        @param value Value which is to be removed.
    228228    */
    229     void PickupCollection::removeAdditiveModifier(ModifierType::Enum type, float value)
     229    void PickupCollection::removeAdditiveModifier(ModifierType::Value type, float value)
    230230    {
    231231        modifier_range range = this->additiveModifiers_.equal_range(type);
    232         for (std::multimap<ModifierType::Enum, float>::iterator it = range.first; it != range.second && it != this->additiveModifiers_.end(); it++)
     232        for (std::multimap<ModifierType::Value, float>::iterator it = range.first; it != range.second && it != this->additiveModifiers_.end(); it++)
    233233        {
    234234            if ((*it).second == value)
     
    244244        @param value Value for the modifier.
    245245    */
    246     void PickupCollection::addMultiplicativeModifier(ModifierType::Enum type, float value)
    247     {
    248         this->multiplicativeModifiers_.insert( std::pair<ModifierType::Enum, float>(type, value) );
     246    void PickupCollection::addMultiplicativeModifier(ModifierType::Value type, float value)
     247    {
     248        this->multiplicativeModifiers_.insert( std::pair<ModifierType::Value, float>(type, value) );
    249249    }
    250250    /**
     
    253253        @return Returns the product of the multiplicative modifiers of the type.
    254254    */
    255     float PickupCollection::getMultiplicativeModifier(ModifierType::Enum type)
     255    float PickupCollection::getMultiplicativeModifier(ModifierType::Value type)
    256256    {
    257257        float v = 1.0f;
    258258
    259259        modifier_range range = this->multiplicativeModifiers_.equal_range(type);
    260         for (std::multimap<ModifierType::Enum, float>::iterator it = range.first; it != range.second && it != this->multiplicativeModifiers_.end(); it++)
     260        for (std::multimap<ModifierType::Value, float>::iterator it = range.first; it != range.second && it != this->multiplicativeModifiers_.end(); it++)
    261261        {
    262262            v *= (*it).second;
     
    270270        @param value Value which is to be removed.
    271271    */
    272     void PickupCollection::removeMultiplicativeModifier(ModifierType::Enum type, float value)
     272    void PickupCollection::removeMultiplicativeModifier(ModifierType::Value type, float value)
    273273    {
    274274        modifier_range range = this->multiplicativeModifiers_.equal_range(type);
    275         for (std::multimap<ModifierType::Enum, float>::iterator it = range.first; it != range.second && it != this->multiplicativeModifiers_.end(); it++)
     275        for (std::multimap<ModifierType::Value, float>::iterator it = range.first; it != range.second && it != this->multiplicativeModifiers_.end(); it++)
    276276        {
    277277            if ((*it).second == value)
     
    289289        @return Returns the value after being processed.
    290290    */
    291     float PickupCollection::processModifiers(ModifierType::Enum type, float inputValue, bool addBeforeMultiplication)
     291    float PickupCollection::processModifiers(ModifierType::Value type, float inputValue, bool addBeforeMultiplication)
    292292    {
    293293        float outputValue = inputValue;
     
    310310        @return Returns the value after being processed.
    311311    */
    312     Vector3 PickupCollection::processModifiers(ModifierType::Enum type, Vector3 inputValue, bool addBeforeMultiplication)
     312    Vector3 PickupCollection::processModifiers(ModifierType::Value type, Vector3 inputValue, bool addBeforeMultiplication)
    313313    {
    314314        Vector3 outputValue = inputValue;
  • code/branches/core4/src/orxonox/objects/pickup/PickupCollection.h

    r3196 r3257  
    6767        void useItem(UsableItem* item);                                             //!< Use a usable item.
    6868
    69         void addAdditiveModifier(ModifierType::Enum type, float value);             //!< Add an additive modifier.
    70         void addMultiplicativeModifier(ModifierType::Enum type, float value);       //!< Add a multiplicative modifier.
     69        void addAdditiveModifier(ModifierType::Value type, float value);             //!< Add an additive modifier.
     70        void addMultiplicativeModifier(ModifierType::Value type, float value);       //!< Add a multiplicative modifier.
    7171
    72         float getAdditiveModifier(ModifierType::Enum type);                         //!< Get total additive modifier.
    73         float getMultiplicativeModifier(ModifierType::Enum type);                   //!< Get total multiplicative modifier.
     72        float getAdditiveModifier(ModifierType::Value type);                         //!< Get total additive modifier.
     73        float getMultiplicativeModifier(ModifierType::Value type);                   //!< Get total multiplicative modifier.
    7474
    75         void removeAdditiveModifier(ModifierType::Enum type, float value);          //!< Remove an additive modifier.
    76         void removeMultiplicativeModifier(ModifierType::Enum type, float value);    //!< Remove a multiplicative modifier.
     75        void removeAdditiveModifier(ModifierType::Value type, float value);          //!< Remove an additive modifier.
     76        void removeMultiplicativeModifier(ModifierType::Value type, float value);    //!< Remove a multiplicative modifier.
    7777
    78         float processModifiers(ModifierType::Enum type, float inputValue, bool addBeforeMultiplication = false);        //!< Apply the modifiers to a float.
    79         Vector3 processModifiers(ModifierType::Enum type, Vector3 inputValue, bool addBeforeMultiplication = false);    //!< Apply the modifiers to a Vector3.
     78        float processModifiers(ModifierType::Value type, float inputValue, bool addBeforeMultiplication = false);        //!< Apply the modifiers to a float.
     79        Vector3 processModifiers(ModifierType::Value type, Vector3 inputValue, bool addBeforeMultiplication = false);    //!< Apply the modifiers to a Vector3.
    8080
    8181        /**
     
    113113        bool bBlockRemovals_;   //!< Whether to block direct removals through remove().
    114114
    115         std::multimap<ModifierType::Enum, float> additiveModifiers_;        //!< Contains additive modifiers (indexed by ModifierType).
    116         std::multimap<ModifierType::Enum, float> multiplicativeModifiers_;  //!< Contains multiplicative modifiers (indexed by ModifierType).
     115        std::multimap<ModifierType::Value, float> additiveModifiers_;        //!< Contains additive modifiers (indexed by ModifierType).
     116        std::multimap<ModifierType::Value, float> multiplicativeModifiers_;  //!< Contains multiplicative modifiers (indexed by ModifierType).
    117117
    118118        std::multimap<std::string, BaseItem*> items_;                       //!< Map of items in the collection (indexed by pickupIdentifier of the items).
Note: See TracChangeset for help on using the changeset viewer.