Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 25, 2009, 11:07:09 PM (15 years ago)
Author:
rgrieder
Message:

Merged pickup2 into pickup3.

Location:
code/branches/pickup3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pickup3

  • code/branches/pickup3/src/orxonox/pickup/ModifierPickup.h

    r6417 r6419  
    4747{
    4848    /**
    49         @brief Class for a (temporary) modifier effect.
    50         @author Daniel 'Huty' Haggenmueller
     49    @brief Class for a (temporary) modifier effect.
     50    @author Daniel 'Huty' Haggenmueller
    5151    */
     52    //TODO: More elaborate comments.
    5253    class _OrxonoxExport ModifierPickup : public PassiveItem
    5354    {
    54     public:
    55         ModifierPickup(BaseObject* creator);
    56         virtual ~ModifierPickup();
     55        //TODO: What does being derived from PassiveItem add exactly? Probably better to kill PassiveItem and just derive from BaseItem.
     56        //Include ModifierType here, no additional header file needed for that, imo.
     57        public:
     58            ModifierPickup(BaseObject* creator);
     59            virtual ~ModifierPickup();
    5760
    58         virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< To create a ModifierPickup through the level file.
     61            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< To create a ModifierPickup through the level file.
    5962
    60         virtual bool pickedUp(Pawn* pawn);                              //!< Override of the BaseItem::pickedUp() method.
    61         virtual bool dropped(Pawn* pawn);                              //!< Override of the BaseItem::dropped() method
     63            virtual bool pickedUp(Pawn* pawn); //!< Override of the BaseItem::pickedUp() method.
     64            virtual bool dropped(Pawn* pawn); //!< Override of the BaseItem::dropped() method
    6265
    63         virtual int getMaxCarryAmount(){ return INT_MAX; }              //!< Allow the player to carry infinite ModPickups
     66            //TODO: Where does this INT_MAX come from? Comment.
     67            virtual int getMaxCarryAmount() //!< Allow the player to carry infinite ModPickups
     68                { return INT_MAX; }
    6469
    65         /**
     70            /**
    6671            @brief Get the duration of this pickup.
    6772            @return Returns how long the effect holds on.
    68         */
    69         inline float getDuration() const
    70             { return this->duration_; }
    71         /**
     73            */
     74            inline float getDuration() const
     75                { return this->duration_; }
     76            /**
    7277            @brief Set the duration of this pickup.
    7378            @param duration How long the effect should hold.
    74         */
    75         inline void setDuration(float duration)
    76             { this->duration_ = duration; }
     79            */
     80            //TODO: Better be private?
     81            inline void setDuration(float duration)
     82                { this->duration_ = duration; }
    7783
    78         /**
     84            //TODO: Shouldn't these all be seperate pickup items? But, then, would this class really be needed? What does it actually add?
     85            //Duration! Thus create two virtual functions addEffect() and removeEffect().
     86            //Export the ideas here into seperate, individual subclasses.
     87            //Shouldn't this, as an item be in the items folder? or is it, as merely the equivalent of an abstract class not specific enough?
     88            //Specify what ModifierItem should do exactly. If the limited duration is the core functionality, another name would probably more fitting.
     89            //Perhaps, limited effect duration could also just be another feature of BaseItem...
     90            /**
    7991            @brief Get the amount of damage this pickup adds.
    8092            @return Returns how much damage this pickup adds.
    81         */
    82         inline float getAdditiveDamage() const
    83             { return this->getAdditiveModifier(ModifierType::Damage); }
    84         /**
     93            */
     94            inline float getAdditiveDamage() const
     95                { return this->getAdditiveModifier(ModifierType::Damage); }
     96            /**
    8597            @brief Get the factor by which this pickup multiplies the damage.
    8698            @return Returns the factor by which to multiply damage.
    87         */
    88         inline float getMultiplicativeDamage() const
    89             { return this->getMultiplicativeModifier(ModifierType::Damage); }
     99            */
     100            inline float getMultiplicativeDamage() const
     101                { return this->getMultiplicativeModifier(ModifierType::Damage); }
    90102
    91         /**
     103            /**
    92104            @brief Set the amount of damage this pickup adds.
    93105            @param value How much damage this pickup adds.
    94         */
    95         inline void setAdditiveDamage(float value)
    96             { this->setAdditiveModifier(ModifierType::Damage, value); }
    97         /**
     106            */
     107            inline void setAdditiveDamage(float value)
     108                { this->setAdditiveModifier(ModifierType::Damage, value); }
     109            /**
    98110            @brief Set the factor by which this pickup multiplies the damage.
    99111            @param value Factor by which to multiply damage.
    100         */
    101         inline void setMultiplicativeDamage(float value)
    102             { this->setMultiplicativeModifier(ModifierType::Damage, value); }
     112            */
     113            inline void setMultiplicativeDamage(float value)
     114                { this->setMultiplicativeModifier(ModifierType::Damage, value); }
    103115
    104         /**
     116            /**
    105117            @brief Get the amount of acceleration this pickup adds.
    106118            @return Returns how much acceleration this pickup adds.
    107         */
    108         inline float getAdditiveAcceleration() const
    109             { return this->getAdditiveModifier(ModifierType::Acceleration); }
    110         /**
     119            */
     120            inline float getAdditiveAcceleration() const
     121                { return this->getAdditiveModifier(ModifierType::Acceleration); }
     122            /**
    111123            @brief Get the factor by which this pickup multiplies the acceleration.
    112124            @return Returns the factor by which to multiply acceleration.
    113         */
    114         inline float getMultiplicativeAcceleration() const
    115             { return this->getMultiplicativeModifier(ModifierType::Acceleration); }
     125            */
     126            inline float getMultiplicativeAcceleration() const
     127                { return this->getMultiplicativeModifier(ModifierType::Acceleration); }
    116128
    117         /**
     129            /**
    118130            @brief Set the amount of acceleration this pickup adds.
    119131            @param value How much acceleration this pickup adds.
    120         */
    121         inline void setAdditiveAcceleration(float value)
    122             { this->setAdditiveModifier(ModifierType::Acceleration, value); }
    123         /**
     132            */
     133            inline void setAdditiveAcceleration(float value)
     134                { this->setAdditiveModifier(ModifierType::Acceleration, value); }
     135            /**
    124136            @brief Set the factor by which this pickup multiplies the acceleration.
    125137            @param value Factor by which to multiply acceleration.
    126         */
    127         inline void setMultiplicativeAcceleration(float value)
    128             { this->setMultiplicativeModifier(ModifierType::Acceleration, value); }
     138            */
     139            inline void setMultiplicativeAcceleration(float value)
     140                { this->setMultiplicativeModifier(ModifierType::Acceleration, value); }
    129141
    130         void timerCallback(Pawn* pawn);     //!< Method called when the timer runs out.
     142            //TODO: Make private?
     143            void timerCallback(Pawn* pawn);     //!< Method called when the timer runs out.
    131144
    132     private:
    133         float getAdditiveModifier(ModifierType::Value type) const;               //!< Get the additive modifier for a given ModifierType.
    134         float getMultiplicativeModifier(ModifierType::Value type) const;         //!< Get the multiplicative modifier for a given ModifierType.
    135         void setAdditiveModifier(ModifierType::Value type, float value);         //!< Set the additive modifier for a given ModifierType.
    136         void setMultiplicativeModifier(ModifierType::Value type, float value);   //!< Set the multiplicative modifier for a given ModifierType
     145        private:
     146            float getAdditiveModifier(ModifierType::Value type) const;               //!< Get the additive modifier for a given ModifierType.
     147            float getMultiplicativeModifier(ModifierType::Value type) const;         //!< Get the multiplicative modifier for a given ModifierType.
     148            void setAdditiveModifier(ModifierType::Value type, float value);         //!< Set the additive modifier for a given ModifierType.
     149            void setMultiplicativeModifier(ModifierType::Value type, float value);   //!< Set the multiplicative modifier for a given ModifierType
    137150
    138         std::map<ModifierType::Value, float> additiveModifiers_;                 //!< Map of additive modifiers, indexed by ModifierType.
    139         std::map<ModifierType::Value, float> multiplicativeModifiers_;           //!< Map of multiplicative modifiers, indexed by ModifierType.
     151            std::map<ModifierType::Value, float> additiveModifiers_;                 //!< Map of additive modifiers, indexed by ModifierType.
     152            std::map<ModifierType::Value, float> multiplicativeModifiers_;           //!< Map of multiplicative modifiers, indexed by ModifierType.
    140153
    141         float duration_;                                                         //!< Duration of this pickup's effect (0 for unlimited).
    142         Timer timer_;                                                            //!< Timer used if the pickup's effect has a time limit.
     154            float duration_;                                                         //!< Duration of this pickup's effect (0 for unlimited).
     155            Timer timer_;                                                            //!< Timer used if the pickup's effect has a time limit.
    143156    };
    144157}
Note: See TracChangeset for help on using the changeset viewer.