Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5902 for code


Ignore:
Timestamp:
Oct 7, 2009, 2:20:43 PM (15 years ago)
Author:
dafrick
Message:

Added comments and a lot of TODO's, many of which probably are obsolete by now, so don't mind them, they're just to help me remember, what I thought at the time I went through that particular code.

Location:
code/branches/pickup/src/orxonox/pickup
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pickup/src/orxonox/pickup/BaseItem.cc

    r5781 r5902  
    4141{
    4242    /**
    43         @brief Constructor. Registers the BaseItem.
    44         @param creator Pointer to the object which created this item.
     43    @brief Constructor. Registers the BaseItem.
     44    @param creator Pointer to the object which created this item.
    4545    */
    4646    BaseItem::BaseItem(BaseObject* creator) : BaseObject(creator)
     
    5959
    6060    /**
    61         @brief XMLPort for BaseItem.
    62         @param xmlelement Element of the XML-file.
    63         @param mode XMLPort mode to use.
     61    @brief XMLPort for BaseItem.
     62    @param xmlelement Element of the XML-file.
     63    @param mode XMLPort mode to use.
    6464    */
    6565    void BaseItem::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     
    7272
    7373    /**
    74         @brief Method to add the item to a pawn.
    75         @param pawn Pawn to which the item should get added.
    76         @return Returns whether the pawn's PickupCollection accepted the item.
     74    @brief Method to add the item to a pawn.
     75    @param pawn Pawn to which the item should get added.
     76    @return Returns whether the pawn's PickupCollection accepted the item.
    7777    */
    7878    bool BaseItem::addTo(Pawn* pawn)
     
    8080        this->setOwner(pawn);
    8181
    82         if (pawn->getPickups().add(this))
     82        if (pawn->getPickups().add(this)) //TODO: Does the pawn store his pickups?
    8383        {
    8484            COUT(3) << "Added '" << this->getPickupIdentifier() << "' item." << std::endl;
  • code/branches/pickup/src/orxonox/pickup/BaseItem.h

    r5781 r5902  
    4444{
    4545    /**
    46         @brief
    47             Base class for all items/pickups.
     46    @brief
     47        Base class for all items/pickups.
    4848
    49             Provides common methods to be used in derived classes.
    50         @author
    51             Daniel 'Huty' Haggenmueller
     49        Provides common methods to be used in derived classes.
     50    @author
     51        Daniel 'Huty' Haggenmueller
    5252    */
    5353    class _OrxonoxExport BaseItem : public BaseObject
    5454    {
    5555// tolua_end
    56     public:
    57         BaseItem(BaseObject* creator);
    58         virtual ~BaseItem();
     56        public:
     57            BaseItem(BaseObject* creator);
     58            virtual ~BaseItem();
    5959
    60         virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);  //!< XMLPort
     60            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);  //!< XMLPort
    6161
    62         /**
     62            /**
    6363            @brief Checks how many instances of this item can be carried at a time.
    6464            @return How many of this item can be carried.
    65         */
    66         virtual int getMaxCarryAmount() const
    67             { return 1; }
     65            */
     66            virtual int getMaxCarryAmount() const //TODO: Maybe, better to just be virtual.
     67                { return BaseItem::MAX_CARRY_AMOUNT; }
    6868
    69         bool addTo(Pawn* pawn);             //!< Add the item to a pawn.
    70         bool removeFrom(Pawn* pawn);        //!< Removes the item from a pawn.
    71         /**
     69            //TODO: Need to be public?
     70            bool addTo(Pawn* pawn);             //!< Add the item to a pawn.
     71            bool removeFrom(Pawn* pawn);        //!< Removes the item from a pawn.
     72            /**
    7273            @brief
    7374                Method invoked when the item gets picked up.
     
    7879            @param pawn Pawn who picks up the item.
    7980            @return Returns whether the pawn was able to pick up the item.
    80         */
    81         virtual bool pickedUp(Pawn* pawn)
    82             { return false; }
    83         /**
     81            */
     82            virtual bool pickedUp(Pawn* pawn) //TODO: Maybe better to be just virtual.
     83                { return false; }
     84            /**
    8485            @brief
    8586                Method invoked when the item is dropped from a player.
     
    9091            @param pawn Pawn which dropped the item.
    9192            @return Returns whether the item was able to get dropped by the pawn.
    92         */
    93         virtual bool dropped(Pawn* pawn)
    94             { return false; }
     93            */
     94            virtual bool dropped(Pawn* pawn)
     95                { return false; }
    9596
    96         /**
     97            /**
    9798            @brief Gets the current owner of the pickup.
    9899            @return Returns the current owner.
    99         */
    100         inline Pawn* getOwner() const
    101             { return this->owner_; }
    102         /**
     100            */
     101            inline Pawn* getOwner() const
     102                { return this->owner_; }
     103            /**
    103104            @brief Sets the owner of the pickup.
    104105            @param owner New owner for the pickup.
    105         */
    106         inline void setOwner(Pawn* owner)
    107             { this->owner_ = owner; }
     106            */
     107            inline void setOwner(Pawn* owner)
     108                { this->owner_ = owner; }
    108109
    109         /**
     110            /**
    110111            @brief Gets the pickupIdentifier of the item.
    111112            @return Returns the pickupIdentifier of the item.
    112113            @see pickupIdentifier_
    113         */
    114         inline const std::string& getPickupIdentifier() const
    115             { return this->pickupIdentifier_; }
    116         /**
     114            */
     115            inline const std::string& getPickupIdentifier() const
     116                { return this->pickupIdentifier_; }
     117            /**
    117118            @brief Sets the pickupIdentifier for the item.
    118119            @param identifier New pickupIdentifier for the item.
    119120            @see pickupIdentifier_
    120         */
    121         inline void setPickupIdentifier(const std::string& identifier)
    122             { this->pickupIdentifier_ = identifier; }
     121            */
     122            //TODO: Needs to be public?
     123            inline void setPickupIdentifier(const std::string& identifier)
     124                { this->pickupIdentifier_ = identifier; }
    123125
    124         // GUI stuff
    125         virtual const std::string& getGUIText() const; // tolua_export
    126         inline void setGUIText(const std::string& text)
    127             { this->guiText_ = text; }
     126            // GUI stuff
     127            //TODO: Comment. Maybe seperate GUI from Pickup, e.g. ItemDescription...
     128            virtual const std::string& getGUIText() const; // tolua_export
     129            inline void setGUIText(const std::string& text)
     130                { this->guiText_ = text; }
    128131
    129         virtual const std::string& getGUIImage() const
    130             { return this->guiImage_; }
    131         inline void setGUIImage(const std::string& image)
    132             { this->guiImage_ = image; }
    133     private:
    134         Pawn* owner_;   //!< The current owner of the item.
     132            virtual const std::string& getGUIImage() const
     133                { return this->guiImage_; }
     134            inline void setGUIImage(const std::string& image)
     135                { this->guiImage_ = image; }
     136        private:
     137            static const int MAX_CARRY_AMOUNT = 1;
    135138
    136         /**
     139            Pawn* owner_;   //!< The current owner of the item.
     140
     141            /**
    137142            @brief
    138143                The pickupIdentifier of the item..
     
    140145                Usually set to the template name used by a PickupSpawner,
    141146                used to index items in the PickupCollection.
    142         */
    143         std::string pickupIdentifier_;
     147            */
     148            std::string pickupIdentifier_; //TODO: Remove, when always just this->getName().
    144149
    145         std::string guiText_;
    146         std::string guiImage_;
     150            //TODO: Comment.
     151            std::string guiText_;
     152            std::string guiImage_;
    147153    }; // tolua_export
    148154} // tolua_export
  • code/branches/pickup/src/orxonox/pickup/DroppedItem.cc

    r5781 r5902  
    4141    CreateFactory(DroppedItem);
    4242
     43    /**
     44    @brief
     45        Constructor. Registers object and sets default values.
     46    */
    4347    DroppedItem::DroppedItem(BaseObject* creator) : StaticEntity(creator)
    4448    {
     
    4751        this->triggerDistance_ = 20.0f;
    4852        this->timeToLive_ = 0;
    49         this->item_ = 0;
     53        this->item_ = NULL;
    5054    }
     55
     56    /**
     57    @brief
     58        Default destructor.
     59    */
     60    //TODO: Destroy something?
    5161    DroppedItem::~DroppedItem()
    5262    {
     63       
    5364    }
     65
     66    /**
     67    @brief
     68        Checks whether any pawn is in triggerDistance of the Item and calls this->trigger if so.
     69    @param dt
     70        The  duration of the last time interval.   
     71    */
     72    //TODO: Replace this with a DistanceTrigger!
    5473    void DroppedItem::tick(float dt)
    5574    {
    5675        if (this->item_)
    5776        {
    58             for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); it++)
     77            for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); it++) //!< Iterate through all Pawns.
    5978            {
    6079                Vector3 distance = it->getWorldPosition() - this->getWorldPosition();
     
    6483        }
    6584    }
     85
     86    /**
     87    @brief
     88        Called when the DroppedItem is triggered. Adds the item to the triggering pawn.
     89    */
    6690    void DroppedItem::trigger(Pawn* pawn)
    6791    {
    68         if (this->item_->pickedUp(pawn))
     92        if (this->item_->pickedUp(pawn)) //If pickup was successful.
    6993        {
    7094            COUT(3) << "DroppedItem '" << this->item_->getPickupIdentifier() << "' picked up." << std::endl;
     
    7296        }
    7397    }
     98
     99    /**
     100    @brief
     101        Creates a timer to call this->timerCallback() at expiration of timeToLive.
     102    */
     103    //TODO: Better Comments.
    74104    void DroppedItem::createTimer()
    75105    {
     
    80110        }
    81111    }
     112   
     113    /**
     114    @brief
     115        Destroys the item. Called by the set timer upon its expiration.
     116    */
     117    //TODO: Choose better function name if this doesn't create dependency inconsistencies. e.g. this->destroy() or this->timeOut()
     118    //Make certain that only one pawn has the same item, because if not, deliting the item would lead to a possible segfault.
     119    //If the item is destroyed here, shouldn't it be destroyed in the destructor as well?
    82120    void DroppedItem::timerCallback()
    83121    {
     
    91129    }
    92130
    93     DroppedItem* DroppedItem::createDefaultDrop(BaseItem* item, const Vector3& position, const ColourValue& flareColour, float timeToLive)
     131    /**
     132    @brief
     133       
     134    */
     135    //TODO: Comment.
     136    //This is for pawns dropping items they have...
     137    //Probably better to create a spawner with only 1 item in it.
     138    //Various different thigs are done here, which in my opinion should eighter be done in XML or some where else, preferably in XML.
     139    //Each pickup should have a XML template where the Model and Billboard, and so on, is specified.
     140    //The position, item and timetoLive should be specified by this Classes XMLPort function.
     141    //These adjustments above, will very likely create inkonsistencies in the level files, possibly templates.
     142    /*static*/ DroppedItem* DroppedItem::createDefaultDrop(BaseItem* item, const Vector3& position, const ColourValue& flareColour, float timeToLive)
    94143    {
    95144        DroppedItem* drop = new DroppedItem(item);
     
    117166        return drop;
    118167    }
     168
     169    /**
     170    @brief
     171
     172    */
     173    //TODO: See one function above.
    119174    DroppedItem* DroppedItem::createDefaultDrop(BaseItem* item, Pawn* pawn, const ColourValue& flareColour, float timeToLive)
    120175    {
  • code/branches/pickup/src/orxonox/pickup/DroppedItem.h

    r5781 r5902  
    4949        virtual ~DroppedItem();
    5050
     51        //TODO: Comment.
     52        //DroppedItem -> Item with no owner, alone in space?
     53        //Would be much nicer if it would be triggered by a standard issue DistanceTrigger.
     54        //Where is this created? I see no XMLPort.
     55        //Where is the item for this created? What happens if more than one pawn triggers this?
     56        //Add more than just one items, or even better create the ability to add a Collection.? Rename to ...?
     57
    5158        void tick(float dt);
    5259        void trigger(Pawn* pawn);
     
    5562        static DroppedItem* createDefaultDrop(BaseItem* item, Pawn* pawn, const ColourValue& flareColour = ColourValue(0.5f, 1.0f, 0.3f), float timeToLive = 0);
    5663
    57         void createTimer();
    58         void timerCallback();
     64        void createTimer(); //TODO: Can this be made private, too?
     65        void timerCallback(); //TODO: This should really be private.
    5966
    6067        inline float getTriggerDistance() const
     
    6572        inline BaseItem* getItem() const
    6673            { return this->item_; }
     74        //TODO: Needs to be public?
    6775        inline void setItem(BaseItem* item)
    6876            { this->item_ = item; }
     
    7078        inline float getTimeToLive() const
    7179            { return this->timeToLive_; }
     80        //TODO: Needs to be public?
    7281        inline void setTimeToLive(float time)
    7382            { this->timeToLive_ = time; }
  • code/branches/pickup/src/orxonox/pickup/EquipmentItem.cc

    r5781 r5902  
    3838{
    3939    /**
    40         @brief Constructor. Registers the EquipmentItem.
    41         @param creator Pointer to the object which created this item.
     40    @brief Constructor. Registers the EquipmentItem.
     41    @param creator Pointer to the object which created this item.
    4242    */
    4343    EquipmentItem::EquipmentItem(BaseObject* creator) : BaseItem(creator)
  • code/branches/pickup/src/orxonox/pickup/EquipmentItem.h

    r5781 r5902  
    4141{
    4242    /**
    43         @brief Base class for all equipment-type items.
    44         @author Daniel 'Huty' Haggenmueller
     43    @brief Base class for all equipment-type items.
     44    @author Daniel 'Huty' Haggenmueller
    4545    */
    4646    class _OrxonoxExport EquipmentItem : public BaseItem
    4747    {
    48     public:
    49         EquipmentItem(BaseObject* creator);
    50         virtual ~EquipmentItem() {}
     48        //TODO: What is this class for?
     49        //Probably falls under UsableItem or PassiveItem
     50        public:
     51            EquipmentItem(BaseObject* creator);
     52            virtual ~EquipmentItem() {}
     53
     54       
     55
    5156    };
    5257}
  • code/branches/pickup/src/orxonox/pickup/ModifierPickup.cc

    r5781 r5902  
    4343
    4444    /**
    45         @brief Constructor. Registers the ModifierPickup.
    46         @param creator Pointer to the object which created this item.
     45    @brief
     46        Constructor. Registers the ModifierPickup.
     47    @param creator
     48        Pointer to the object which created this item.
    4749    */
    4850    ModifierPickup::ModifierPickup(BaseObject* creator) : PassiveItem(creator)
     
    5254        this->duration_ = 0.0f;
    5355    }
    54     //! Deconstructor.
     56
     57    /**
     58    @brief
     59        Destructor.
     60    */
    5561    ModifierPickup::~ModifierPickup()
    5662    {
    57     }
    58     /**
    59         @brief Method for loading information from a level file.
    60         @param element XMLElement from which to read the data.
    61         @param mode XMLPort mode to use.
    62     */
     63       
     64    }
     65
     66    /**
     67    @brief
     68        Method for loading information from a level file.
     69    @param element
     70        XMLElement from which to read the data.
     71    @param mode
     72        XMLPort mode to use.
     73    */
     74    //TODO: Comments: params can probably be ommitted.
    6375    void ModifierPickup::XMLPort(Element& element, XMLPort::Mode mode)
    6476    {
     
    7385        XMLPortParamTemplate(ModifierPickup, "accelerationMulti", setMultiplicativeAcceleration, getMultiplicativeAcceleration, element, mode, float);
    7486    }
    75     /**
    76         @brief
    77             Invoked when a pawn picks up the pickup.
    78 
    79             Adds the modifiers to the pawn and sets a timer (if effect is limited)
    80             if the pickup could be added to the pawn's PickupCollection.
    81 
    82         @param pawn Pawn which picked up the pickup.
    83         @return Returns whether the pickup was able to be added to the pawn.
     87
     88    /**
     89    @brief
     90        Invoked when a pawn picks up the pickup.
     91
     92        Adds the modifiers to the pawn and sets a timer (if effect is limited)
     93        if the pickup could be added to the pawn's PickupCollection.
     94
     95    @param pawn
     96        Pawn which picked up the pickup.
     97    @return
     98        Returns whether the pickup was able to be added to the pawn.
    8499    */
    85100    bool ModifierPickup::pickedUp(Pawn* pawn)
     
    110125        return false;
    111126    }
    112     /**
    113         @brief
    114             Invoked when a pawn drops the pickup.
    115 
    116             Removes the modifiers from the pawn if the pickup
    117             was successfully removed from it's PickupCollection.
    118 
    119         @param pawn Pawn which dropped the pickup.
    120         @return Returns whether the pickup could be removed.
     127
     128    /**
     129    @brief
     130        Invoked when a pawn drops the pickup.
     131
     132        Removes the modifiers from the pawn if the pickup
     133        was successfully removed from it's PickupCollection.
     134
     135    @param pawn
     136        Pawn which dropped the pickup.
     137    @return
     138        Returns whether the pickup could be removed.
    121139    */
    122140    bool ModifierPickup::dropped(Pawn* pawn)
     
    145163        return false;
    146164    }
    147     /**
    148         @brief Invoked when the timer finished, calls dropped().
    149     */
     165
     166    /**
     167    @brief Invoked when the timer finished, calls dropped().
     168    */
     169    //TODO: Other name for function?
    150170    void ModifierPickup::timerCallback(Pawn* pawn)
    151171    {
     
    153173            COUT(2) << "Failed to remove modifier pickup after the timer ran out!" << std::endl;
    154174    }
    155     /**
    156         @brief Gets the additive modifier of a given type.
    157         @param type ModifierType for which to return the modifier.
    158         @return Returns the additive modifier for type (or 0 if not exists).
     175
     176    /**
     177    @brief
     178        Gets the additive modifier of a given type.
     179    @param type
     180        ModifierType for which to return the modifier.
     181    @return
     182        Returns the additive modifier for type (or 0 if not exists).
    159183    */
    160184    float ModifierPickup::getAdditiveModifier(ModifierType::Value type) const
     
    166190            return 0.0f;
    167191    }
    168     /**
    169         @brief Gets the multiplicative modifier of a given type.
    170         @param type ModifierType for which to return the modifier.
    171         @return Returns the multiplicative modifier for type (or 1 if not exists).
     192
     193    /**
     194    @brief
     195        Gets the multiplicative modifier of a given type.
     196    @param type
     197        ModifierType for which to return the modifier.
     198    @return
     199        Returns the multiplicative modifier for type (or 1 if not exists).
    172200    */
    173201    float ModifierPickup::getMultiplicativeModifier(ModifierType::Value type) const
     
    179207            return 1.0f;
    180208    }
    181     /**
    182         @brief Gets the additive modifier of a given type.
    183         @param type ModifierType for which to return the modifier.
    184         @param value The new additive modifier for type.
     209
     210    /**
     211    @brief
     212        Gets the additive modifier of a given type.
     213    @param type
     214        ModifierType for which to return the modifier.
     215    @param value
     216        The new additive modifier for type.
    185217    */
    186218    void ModifierPickup::setAdditiveModifier(ModifierType::Value type, float value)
     
    191223            this->additiveModifiers_[type] = value;
    192224    }
    193     /**
    194         @brief Gets the multiplicative modifier of a given type.
    195         @param type ModifierType for which to return the modifier.
    196         @param value The new multiplicative modifier for type.
     225
     226    /**
     227    @brief
     228        Gets the multiplicative modifier of a given type.
     229    @param type
     230        ModifierType for which to return the modifier.
     231    @param value
     232        The new multiplicative modifier for type.
    197233    */
    198234    void ModifierPickup::setMultiplicativeModifier(ModifierType::Value type, float value)
     
    203239            this->multiplicativeModifiers_[type] = value;
    204240    }
     241
    205242}
  • code/branches/pickup/src/orxonox/pickup/ModifierPickup.h

    r5781 r5902  
    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.
    131     private:
    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
     142            //TODO: Make private?
     143            void timerCallback(Pawn* pawn);     //!< Method called when the timer runs out.
     144        private:
     145            float getAdditiveModifier(ModifierType::Value type) const;               //!< Get the additive modifier for a given ModifierType.
     146            float getMultiplicativeModifier(ModifierType::Value type) const;         //!< Get the multiplicative modifier for a given ModifierType.
     147            void setAdditiveModifier(ModifierType::Value type, float value);         //!< Set the additive modifier for a given ModifierType.
     148            void setMultiplicativeModifier(ModifierType::Value type, float value);   //!< Set the multiplicative modifier for a given ModifierType
    136149
    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.
     150            std::map<ModifierType::Value, float> additiveModifiers_;                 //!< Map of additive modifiers, indexed by ModifierType.
     151            std::map<ModifierType::Value, float> multiplicativeModifiers_;           //!< Map of multiplicative modifiers, indexed by ModifierType.
    139152
    140         float duration_;                                                        //!< Duration of this pickup's effect (0 for unlimited).
    141         Timer<ModifierPickup> timer_;                                           //!< Timer used if the pickup's effect has a time limit.
     153            float duration_;                                                        //!< Duration of this pickup's effect (0 for unlimited).
     154            Timer<ModifierPickup> timer_;                                           //!< Timer used if the pickup's effect has a time limit.
    142155    };
    143156}
  • code/branches/pickup/src/orxonox/pickup/ModifierType.h

    r5781 r5902  
    3939namespace orxonox
    4040{
     41    //TODO: Merge with ModifierPickup.
    4142    namespace ModifierType
    4243    {
  • code/branches/pickup/src/orxonox/pickup/PassiveItem.cc

    r5781 r5902  
    3333{
    3434    /**
    35         @brief Constructor. Registers the PassiveItem.
    36         @param creator Pointer to the object which created this item.
     35    @brief Constructor. Registers the PassiveItem.
     36    @param creator Pointer to the object which created this item.
    3737    */
    3838    PassiveItem::PassiveItem(BaseObject* creator) : BaseItem(creator)
  • code/branches/pickup/src/orxonox/pickup/PassiveItem.h

    r5781 r5902  
    4141{
    4242    /**
    43         @brief Base class for all passive items.
    44         @author Daniel 'Huty' Haggenmueller
     43    @brief Base class for all passive items.
     44    @author Daniel 'Huty' Haggenmueller
    4545    */
    4646    class _OrxonoxExport PassiveItem : public BaseItem
    4747    {
    48     public:
    49         PassiveItem(BaseObject* creator);
    50         virtual ~PassiveItem() {}
     48        //TODO: What is this Class for. Where is ActiveItem?
     49        //Rename it InstantItem?
     50        public:
     51            PassiveItem(BaseObject* creator);
     52            virtual ~PassiveItem() {}
     53
    5154    };
    5255}
  • code/branches/pickup/src/orxonox/pickup/PickupCollection.h

    r5781 r5902  
    4747{
    4848    /**
    49         @brief PickupCollection for organising items.
    50         @author Daniel 'Huty' Haggenmueller
     49    @brief PickupCollection for organising items.
     50    @author Daniel 'Huty' Haggenmueller
    5151    */
    5252    class _OrxonoxExport PickupCollection
    5353    {
    54     public:
    55         PickupCollection();
     54        public:
     55            //TODO: Should probably be derived from OrxonoxClass???
     56            PickupCollection();
    5657
    57         bool add(BaseItem* item);       //!< Add an item to the collection.
     58            bool add(BaseItem* item);       //!< Add an item to the collection.
    5859
    59         bool checkSlot(BaseItem* item); //!< Check if there's a free slot in the collection for an item.
     60            bool checkSlot(BaseItem* item); //!< Check if there's a free slot in the collection for an item.
    6061
    61         void clear();                   //!< Empty the collection
    62         bool contains(BaseItem* item, bool anyOfType = false);                      //!< Check if the collection contains an item.
     62            void clear();                   //!< Empty the collection
     63            bool contains(BaseItem* item, bool anyOfType = false);                      //!< Check if the collection contains an item.
    6364
    64         void remove(BaseItem* item, bool removeAllOfType = false);                  //!< Remove an item from the collection.
     65            void remove(BaseItem* item, bool removeAllOfType = false);                  //!< Remove an item from the collection.
    6566
    66         void useItem();                                                             //!< Use the first usable item.
    67         void useItem(UsableItem* item);                                             //!< Use a usable item.
     67            //TODO: What's up with that?
     68            void useItem();                                                             //!< Use the first usable item.
     69            void useItem(UsableItem* item);                                             //!< Use a usable item.
    6870
    69         void addAdditiveModifier(ModifierType::Value type, float value);             //!< Add an additive modifier.
    70         void addMultiplicativeModifier(ModifierType::Value type, float value);       //!< Add a multiplicative modifier.
     71            //TODO: This really shouldn't be here. It's nbot the Collections business to know about stuff like that.
     72            void addAdditiveModifier(ModifierType::Value type, float value);             //!< Add an additive modifier.
     73            void addMultiplicativeModifier(ModifierType::Value type, float value);       //!< Add a multiplicative modifier.
    7174
    72         float getAdditiveModifier(ModifierType::Value type);                         //!< Get total additive modifier.
    73         float getMultiplicativeModifier(ModifierType::Value type);                   //!< Get total multiplicative modifier.
     75            float getAdditiveModifier(ModifierType::Value type);                         //!< Get total additive modifier.
     76            float getMultiplicativeModifier(ModifierType::Value type);                   //!< Get total multiplicative modifier.
    7477
    75         void removeAdditiveModifier(ModifierType::Value type, float value);          //!< Remove an additive modifier.
    76         void removeMultiplicativeModifier(ModifierType::Value type, float value);    //!< Remove a multiplicative modifier.
     78            void removeAdditiveModifier(ModifierType::Value type, float value);          //!< Remove an additive modifier.
     79            void removeMultiplicativeModifier(ModifierType::Value type, float value);    //!< Remove a multiplicative modifier.
    7780
    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.
     81            float processModifiers(ModifierType::Value type, float inputValue, bool addBeforeMultiplication = false);        //!< Apply the modifiers to a float.
     82            Vector3 processModifiers(ModifierType::Value type, Vector3 inputValue, bool addBeforeMultiplication = false);    //!< Apply the modifiers to a Vector3.
    8083
    81         /**
    82             @brief Get the map of contained items.
    83             @return The map of items.
    84         */
    85         std::multimap<std::string, BaseItem*> getItems() const
    86             { return this->items_; }
     84            /**
     85                @brief Get the map of contained items.
     86                @return The map of items.
     87            */
     88            std::multimap<std::string, BaseItem*> getItems() const
     89                { return this->items_; }
    8790
    88         /**
    89             @brief Get the owner of the PickupCollection.
    90             @return Returns the pawn which owns the PickupCollection.
    91         */
    92         inline Pawn* getOwner() const
    93             { return this->owner_; }
    94         /**
    95             @brief Set the owner of the PickupCollection.
    96             @param owner The new Pawn which owns the PickupCollection.
    97         */
    98         inline void setOwner(Pawn* owner)
    99             { this->owner_ = owner; }
     91            /**
     92                @brief Get the owner of the PickupCollection.
     93                @return Returns the pawn which owns the PickupCollection.
     94            */
     95            inline Pawn* getOwner() const
     96                { return this->owner_; }
     97            /**
     98                @brief Set the owner of the PickupCollection.
     99                @param owner The new Pawn which owns the PickupCollection.
     100            */
     101            inline void setOwner(Pawn* owner)
     102                { this->owner_ = owner; }
    100103
    101         inline UsableItem* getCurrentUsable()
    102             { return this->currentUsable_; };
    103         inline void setCurrentUsable(UsableItem* usable)
    104             { this->currentUsable_ = usable; }
     104            inline UsableItem* getCurrentUsable()
     105                { return this->currentUsable_; };
     106            inline void setCurrentUsable(UsableItem* usable)
     107                { this->currentUsable_ = usable; }
    105108
    106         std::deque<EquipmentItem*> getEquipmentItems();   //!< Get a list of equipment-type items.
    107         std::deque<PassiveItem*> getPassiveItems();     //!< Get a list of passive items.
    108         std::deque<UsableItem*> getUsableItems();      //!< Get a list of usable items.
    109     private:
    110         Pawn* owner_;           //!< The owner of the PickupCollection.
    111         UsableItem* currentUsable_;
     109            std::deque<EquipmentItem*> getEquipmentItems();   //!< Get a list of equipment-type items.
     110            std::deque<PassiveItem*> getPassiveItems();     //!< Get a list of passive items.
     111            std::deque<UsableItem*> getUsableItems();      //!< Get a list of usable items.
     112        private:
     113            Pawn* owner_;           //!< The owner of the PickupCollection.
     114            UsableItem* currentUsable_;
    112115
    113         bool bBlockRemovals_;   //!< Whether to block direct removals through remove().
     116            bool bBlockRemovals_;   //!< Whether to block direct removals through remove().
    114117
    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).
     118            std::multimap<ModifierType::Value, float> additiveModifiers_;        //!< Contains additive modifiers (indexed by ModifierType).
     119            std::multimap<ModifierType::Value, float> multiplicativeModifiers_;  //!< Contains multiplicative modifiers (indexed by ModifierType).
    117120
    118         std::multimap<std::string, BaseItem*> items_;                       //!< Map of items in the collection (indexed by pickupIdentifier of the items).
     121            std::multimap<std::string, BaseItem*> items_;                       //!< Map of items in the collection (indexed by pickupIdentifier of the items).
    119122    };
    120123}
  • code/branches/pickup/src/orxonox/pickup/PickupInventory.cc

    r5781 r5902  
    5252
    5353    PickupInventory* PickupInventory::pickupInventory_s = NULL;
     54
     55    //TODO: Comment.
     56
     57    /**
     58    @brief
     59        Get a Pointer to the PickupInventory Singleton.
     60    @return
     61        A Pointer to the PickupInventory.
     62    */
     63    //TODO: Make SingeltonPtr?
    5464    PickupInventory* PickupInventory::getSingleton()
    5565    {
     
    6070    }
    6171
     72    /**
     73    @brief
     74        Constructor.
     75    */
    6276    PickupInventory::PickupInventory()
    6377    {
    64         this->bInventoryVisible_ = false;
    65         this->visibleEquipmentWindows_ = this->visibleUsableWIndows_ = 0;
     78        //TODO: Maybe some abstraction for the usableWindows, e.g. push and pop...
     79        //RegisterObject() ? In some other Class, too. Which?
     80        this->bInventoryVisible_ = false; //TODO: If OrxonoxClass, this should already be there...
     81        this->visibleEquipmentWindows_ = this->visibleUsableWindows_ = 0;
    6682
    6783        // Create some windows to avoid creating them while playing
     
    7793        this->createdEquipmentWindows_ = this->createdUsableWindows_ = 10;
    7894    }
     95
     96    /**
     97    @brief
     98        Destructor.
     99    */
     100    //TODO: Destroy something?
    79101    PickupInventory::~PickupInventory()
    80102    {
    81103    }
    82104
    83 
    84 
    85     void PickupInventory::toggleInventory()
     105    /**
     106    @brief
     107        Toggles the visibility of the inventory.
     108    */
     109    /*static*/ void PickupInventory::toggleInventory()
    86110    {
    87111        if(PickupInventory::getSingleton()->isVisible()) {
     
    99123    }
    100124
     125    /**
     126    @brief
     127       
     128    */
    101129    unsigned int PickupInventory::getCurrentUsableIndex()
    102130    {
     
    115143        return 0;
    116144    }
     145
    117146    bool PickupInventory::isCurrentUsable(const BaseItem* item)
    118147    {
     
    123152            return false;
    124153    }
     154
    125155    void PickupInventory::selectUsable(unsigned int i)
    126156    {
     
    142172            return 0;
    143173    }
     174
    144175    unsigned int PickupInventory::getUsableCount()
    145176    {
     
    150181            return 0;
    151182    }
     183
    152184    unsigned int PickupInventory::getPassiveCount()
    153185    {
     
    158190            return 0;
    159191    }
     192
    160193    BaseItem* PickupInventory::getEquipmentItem(unsigned int i)
    161194    {
     
    170203            return NULL;
    171204    }
     205
    172206    BaseItem* PickupInventory::getUsableItem(unsigned int i)
    173207    {
     
    182216            return NULL;
    183217    }
     218
    184219    BaseItem* PickupInventory::getPassiveItem(unsigned int i)
    185220    {
     
    225260            equipPane->removeChildWindow("orxonox/Inventory/Items/equ/" + id.str());*/
    226261        }
    227         for(unsigned int i = 0; i < this->visibleUsableWIndows_; i++)
     262        for(unsigned int i = 0; i < this->visibleUsableWindows_; i++)
    228263        {
    229264            std::ostringstream id;
     
    239274        }
    240275    }
     276
    241277    void PickupInventory::updateTabs(CEGUI::WindowManager *winMgr, CEGUI::Window *equipWindow, CEGUI::Window *usableWindow)
    242278    {
     
    269305        }
    270306    }
     307
    271308    void PickupInventory::updateUsable(CEGUI::WindowManager* winMgr, CEGUI::Window* target)
    272309    {
     
    296333                PickupInventory::setWindowProperties(winMgr, target, id.str(), item, colour);
    297334            }
    298             this->visibleUsableWIndows_ = items.size();
     335            this->visibleUsableWindows_ = items.size();
    299336        }
    300337    }
     
    326363        btn->setVisible(false);
    327364    }
     365
    328366    void PickupInventory::setWindowProperties(CEGUI::WindowManager* winMgr, CEGUI::Window* target, const std::string& id, const BaseItem* item, const std::string& textColour)
    329367    {
     
    350388        target->addChildWindow(btn);
    351389    }
     390
    352391}
  • code/branches/pickup/src/orxonox/pickup/PickupInventory.h

    r5781 r5902  
    4444{
    4545    /**
    46         @brief Static class for the inventory GUI window.
    47         @author Daniel 'Huty' Haggenmueller
     46    @brief Static class for the inventory GUI window.
     47    @author Daniel 'Huty' Haggenmueller
    4848    */
    4949    class _OrxonoxExport PickupInventory
    5050    {
    5151// tolua_end
    52     public:
    53         PickupInventory();
    54         virtual ~PickupInventory();
     52        public:
     53            //TODO: Be derived from OrxonoxClass and ScopedSingleton.
     54            //Make some methods private?
     55            PickupInventory();
     56            virtual ~PickupInventory();
    5557
    56         static PickupInventory* getSingleton(); // tolua_export
     58            static PickupInventory* getSingleton(); // tolua_export
    5759
    58         static void toggleInventory(); // tolua_export
     60            static void toggleInventory(); // tolua_export
    5961
    60         static unsigned int getEquipmentCount(); // tolua_export
    61         static unsigned int getUsableCount(); // tolua_export
    62         static unsigned int getPassiveCount(); // tolua_export
     62            static unsigned int getEquipmentCount(); // tolua_export
     63            static unsigned int getUsableCount(); // tolua_export
     64            static unsigned int getPassiveCount(); // tolua_export
    6365
    64         static unsigned int getCurrentUsableIndex(); // tolua_export
    65         static bool isCurrentUsable(const BaseItem* item); // tolua_export
    66         static void selectUsable(unsigned int i); // tolua_export
     66            static unsigned int getCurrentUsableIndex(); // tolua_export
     67            static bool isCurrentUsable(const BaseItem* item); // tolua_export
     68            static void selectUsable(unsigned int i); // tolua_export
    6769
    68         static BaseItem* getEquipmentItem(unsigned int i); // tolua_export
    69         static BaseItem* getUsableItem(unsigned int i); // tolua_export
    70         static BaseItem* getPassiveItem(unsigned int i); // tolua_export
     70            static BaseItem* getEquipmentItem(unsigned int i); // tolua_export
     71            static BaseItem* getUsableItem(unsigned int i); // tolua_export
     72            static BaseItem* getPassiveItem(unsigned int i); // tolua_export
    7173
    72         static std::string getImageForItem(const BaseItem* item); // tolua_export
     74            static std::string getImageForItem(const BaseItem* item); // tolua_export
    7375
    74         void clearInventory(CEGUI::WindowManager* winMgr, CEGUI::Window* equipPane, CEGUI::Window* usablePane); // tolua_export
    75         void updateTabs(CEGUI::WindowManager* winMgr, CEGUI::Window* equipWindow, CEGUI::Window* usableWindow); // tolua_export
     76            void clearInventory(CEGUI::WindowManager* winMgr, CEGUI::Window* equipPane, CEGUI::Window* usablePane); // tolua_export
     77            void updateTabs(CEGUI::WindowManager* winMgr, CEGUI::Window* equipWindow, CEGUI::Window* usableWindow); // tolua_export
    7678
    77         void updateEquipment(CEGUI::WindowManager* winMgr, CEGUI::Window* target);
    78         void updateUsable(CEGUI::WindowManager* winMgr, CEGUI::Window* target);
     79            void updateEquipment(CEGUI::WindowManager* winMgr, CEGUI::Window* target);
     80            void updateUsable(CEGUI::WindowManager* winMgr, CEGUI::Window* target);
    7981
    80         static void createItemWindows(CEGUI::WindowManager* winMgr, const std::string& id, int x, int y);
    81         static void setWindowProperties(CEGUI::WindowManager* winMgr, CEGUI::Window* target, const std::string& id, const BaseItem* item, const std::string& textColour);
     82            static void createItemWindows(CEGUI::WindowManager* winMgr, const std::string& id, int x, int y);
     83            static void setWindowProperties(CEGUI::WindowManager* winMgr, CEGUI::Window* target, const std::string& id, const BaseItem* item, const std::string& textColour);
    8284
    83         const bool isVisible() const
    84             { return this->bInventoryVisible_; }
    85         void setVisible(bool visible)
    86             { this->bInventoryVisible_ = visible; }
    87     private:
    88         bool bInventoryVisible_;
    89         unsigned int createdEquipmentWindows_;
    90         unsigned int createdUsableWindows_;
    91         unsigned int visibleEquipmentWindows_;
    92         unsigned int visibleUsableWIndows_;
     85            const bool isVisible() const
     86                { return this->bInventoryVisible_; }
     87            void setVisible(bool visible)
     88                { this->bInventoryVisible_ = visible; }
     89        private:
     90            bool bInventoryVisible_;
     91            unsigned int createdEquipmentWindows_;
     92            unsigned int createdUsableWindows_;
     93            unsigned int visibleEquipmentWindows_;
     94            unsigned int visibleUsableWindows_;
    9395
    94         static PickupInventory* pickupInventory_s;
     96            static PickupInventory* pickupInventory_s;
    9597    }; // tolua_export
    9698} // tolua_export
  • code/branches/pickup/src/orxonox/pickup/PickupSpawner.cc

    r5781 r5902  
    5353
    5454    /**
    55         @brief Constructor. Registers the PickupSpawner.
    56         @param creator Pointer to the object which created this item.
     55    @brief
     56        Constructor. Registers the PickupSpawner.
     57    @param creator
     58        Pointer to the object which created this item.
    5759    */
    5860    PickupSpawner::PickupSpawner(BaseObject* creator) : StaticEntity(creator)
     
    6567        this->tickSum_ = 0.0f;
    6668    }
    67     //! Deconstructor.
     69
     70    /**
     71    @brief
     72        Destructor.
     73    */
    6874    PickupSpawner::~PickupSpawner()
    6975    {
    70     }
    71     /**
    72         @brief Method for creating a PickupSpawner through XML.
    73         @param xmlelement XML element which contains the PickupSpawner.
    74         @param mode XMLPort mode.
     76       
     77    }
     78
     79    /**
     80    @brief
     81        Method for creating a PickupSpawner through XML.
     82    @param xmlelement
     83        XML element which contains the PickupSpawner.
     84    @param mode
     85        XMLPort mode.
    7586    */
    7687    void PickupSpawner::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     
    8293        XMLPortParam(PickupSpawner, "respawnTime", setRespawnTime, getRespawnTime, xmlelement, mode);
    8394
     95        //TODO: Kill hack.
    8496        // HACKs
    8597        // Load the GUI image as soon as the PickupSpawner gets loaded
     
    100112        PickupInventory::getSingleton();
    101113    }
    102     /**
    103         @brief Invoked when the activity has changed. Sets visibility of attached objects.
     114
     115    /**
     116    @brief
     117        Invoked when the activity has changed. Sets visibility of attached objects.
    104118    */
    105119    void PickupSpawner::changedActivity()
     
    110124            (*it)->setVisible(this->isActive());
    111125    }
    112     /**
    113         @brief Set the template name of the item to spawn, also loads the template.
    114         @param name Name of the new template.
     126
     127    /**
     128    @brief
     129        Set the template name of the item to spawn, also loads the template.
     130    @param name
     131        Name of the new template.
    115132    */
    116133    void PickupSpawner::setItemTemplateName(const std::string& name)
     
    119136        this->itemTemplate_ = Template::getTemplate(name);
    120137    }
    121     /**
    122         @brief Tick, checks if any Pawn is close enough to trigger.
    123         @param dt Time since last tick.
    124     */
     138
     139    /**
     140    @brief
     141        Tick, checks if any Pawn is close enough to trigger.
     142    @param dt
     143        Time since last tick.
     144    */
     145    //TODO: Replace this with a real DistanceTrigger.
    125146    void PickupSpawner::tick(float dt)
    126147    {
     
    140161        }
    141162    }
    142     /**
    143         @brief
    144             Trigger the PickupSpawner.
    145 
    146             Adds the pickup to the Pawn that triggered,
    147             sets the timer to re-activate and deactives the PickupSpawner.
    148 
    149         @param pawn Pawn which triggered the PickupSpawner.
     163
     164    /**
     165    @brief
     166        Trigger the PickupSpawner.
     167
     168        Adds the pickup to the Pawn that triggered,
     169        sets the timer to re-activate and deactives the PickupSpawner.
     170
     171    @param pawn
     172        Pawn which triggered the PickupSpawner.
    150173    */
    151174    void PickupSpawner::trigger(Pawn* pawn)
     
    178201        }
    179202    }
    180     /**
    181         @brief Invoked by the timer, re-activates the PickupSpawner.
     203
     204    /**
     205    @brief
     206        Invoked by the timer, re-activates the PickupSpawner.
    182207    */
    183208    void PickupSpawner::respawnTimerCallback()
  • code/branches/pickup/src/orxonox/pickup/PickupSpawner.h

    r5781 r5902  
    5050    class _OrxonoxExport PickupSpawner : public StaticEntity, public Tickable
    5151    {
    52     public:
    53         PickupSpawner(BaseObject* creator);
    54         virtual ~PickupSpawner();
     52        public:
     53            //TODO: Add limit of items spawned here. Also possibility to spawn collections?
     54            PickupSpawner(BaseObject* creator);
     55            virtual ~PickupSpawner();
    5556
    56         virtual void changedActivity();                                 //!< Invoked when activity has changed (set visibilty).
    57         virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);  //!< Method for creating a PickupSpawner through XML.
    58         virtual void tick(float dt);
     57            virtual void changedActivity();                                 //!< Invoked when activity has changed (set visibilty).
     58            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);  //!< Method for creating a PickupSpawner through XML.
     59            virtual void tick(float dt);
    5960
    60         void trigger(Pawn* pawn);                                       //!< Method called when a Pawn is close enough.
    61         void respawnTimerCallback();                                    //!< Method called when the timer runs out.
     61            void trigger(Pawn* pawn);                                       //!< Method called when a Pawn is close enough.
     62            void respawnTimerCallback();                                    //!< Method called when the timer runs out.
    6263
    63         /**
     64            /**
    6465            @brief Get the template name for the item to spawn.
    6566            @return Returns the name of the template of the item to spawn.
    66         */
    67         inline const std::string& getItemTemplateName() const
    68             { return this->itemTemplateName_; }
    69         void setItemTemplateName(const std::string& name);              //!< Set the template name of the item to spawn.
     67            */
     68            inline const std::string& getItemTemplateName() const
     69                { return this->itemTemplateName_; }
     70            void setItemTemplateName(const std::string& name);              //!< Set the template name of the item to spawn.
    7071
    71         /**
    72             @brief Get the template for the item to spawn.
    73             @return Returns the template of the item to spawn.
    74         */
    75         inline Template* getItemTemplate() const
    76             { return this->itemTemplate_; }
     72            /**
     73                @brief Get the template for the item to spawn.
     74                @return Returns the template of the item to spawn.
     75            */
     76            inline Template* getItemTemplate() const
     77                { return this->itemTemplate_; }
    7778
    78         /**
    79             @brief Get the distance in which to trigger.
    80             @return Returns the distance in which this gets triggered.
    81         */
    82         inline float getTriggerDistance() const
    83             { return this->triggerDistance_; }
    84         /**
    85             @brief Set the distance in which to trigger.
    86             @param value The new distance in which to trigger.
    87         */
    88         inline void setTriggerDistance(float value)
    89             { this->triggerDistance_ = value; }
     79            /**
     80                @brief Get the distance in which to trigger.
     81                @return Returns the distance in which this gets triggered.
     82            */
     83            inline float getTriggerDistance() const
     84                { return this->triggerDistance_; }
     85            /**
     86                @brief Set the distance in which to trigger.
     87                @param value The new distance in which to trigger.
     88            */
     89            inline void setTriggerDistance(float value)
     90                { this->triggerDistance_ = value; }
    9091
    91         /**
    92             @brief Get the time to respawn.
    93             @returns Returns the time after which this gets re-actived.
    94         */
    95         inline float getRespawnTime() const
    96             { return this->respawnTime_; }
    97         /**
    98             @brief Set the time to respawn.
    99             @param time New time after which this gets re-actived.
    100         */
    101         inline void setRespawnTime(float time)
    102             { this->respawnTime_ = time; }
    103     private:
    104         std::string itemTemplateName_;          //!< Template name of the item to spawn.
    105         Template* itemTemplate_;                //!< Template of the item to spawn.
     92            /**
     93                @brief Get the time to respawn.
     94                @returns Returns the time after which this gets re-actived.
     95            */
     96            inline float getRespawnTime() const
     97                { return this->respawnTime_; }
     98            /**
     99                @brief Set the time to respawn.
     100                @param time New time after which this gets re-actived.
     101            */
     102            inline void setRespawnTime(float time)
     103                { this->respawnTime_ = time; }
     104        private:
     105            std::string itemTemplateName_;          //!< Template name of the item to spawn.
     106            Template* itemTemplate_;                //!< Template of the item to spawn.
    106107
    107         float triggerDistance_;                 //!< Distance in which this gets triggered.
     108            float triggerDistance_;                 //!< Distance in which this gets triggered.
    108109
    109         /* Pickup animation */
    110         float tickSum_;                         //!< Adds up tick to use in sine movement
    111         static const float bounceSpeed_s;       //!< Speed of pickup to bounce up and down
    112         static const float bounceDistance_s;    //!< Distance the pickup bounces up and down
    113         static const float rotationSpeed_s;     //!< Rotation speed of pickup
     110            /* Pickup animation */
     111            float tickSum_;                         //!< Adds up tick to use in sine movement
     112            static const float bounceSpeed_s;       //!< Speed of pickup to bounce up and down
     113            static const float bounceDistance_s;    //!< Distance the pickup bounces up and down
     114            static const float rotationSpeed_s;     //!< Rotation speed of pickup
    114115
    115         float respawnTime_;                     //!< Time after which this gets re-actived.
    116         Timer<PickupSpawner> respawnTimer_;     //!< Timer used for re-activating.
     116            float respawnTime_;                     //!< Time after which this gets re-actived.
     117            Timer<PickupSpawner> respawnTimer_;     //!< Timer used for re-activating.
    117118    };
    118119}
  • code/branches/pickup/src/orxonox/pickup/UsableItem.cc

    r5781 r5902  
    3838{
    3939    /**
    40         @brief Constructor. Registers the UsableItem.
    41         @param creator Pointer to the object which created this item.
     40    @brief Constructor. Registers the UsableItem.
     41    @param creator Pointer to the object which created this item.
    4242    */
    4343    UsableItem::UsableItem(BaseObject* creator) : BaseItem(creator)
  • code/branches/pickup/src/orxonox/pickup/UsableItem.h

    r5781 r5902  
    4646    class _OrxonoxExport UsableItem : public BaseItem
    4747    {
    48     public:
    49         UsableItem(BaseObject* creator);
    50         virtual ~UsableItem() { }
     48        //TODO: What is this exactly?
     49        public:
     50            UsableItem(BaseObject* creator);
     51            virtual ~UsableItem() { }
    5152
    52         /**
    53             @brief Method invoked when the item is being used.
    54             @param pawn Pawn which is using the item.
    55         */
    56         virtual void used(Pawn* pawn) { }
     53            /**
     54                @brief Method invoked when the item is being used.
     55                @param pawn Pawn which is using the item.
     56            */
     57            virtual void used(Pawn* pawn) { }
    5758    };
    5859}
  • code/branches/pickup/src/orxonox/pickup/items/HealthImmediate.cc

    r5781 r5902  
    5959    }
    6060
     61    //TODO: Should be destroyed anyways...
    6162    bool HealthImmediate::pickedUp(Pawn* pawn)
    6263    {
  • code/branches/pickup/src/orxonox/pickup/items/HealthImmediate.h

    r5781 r5902  
    4545    class _OrxonoxExport HealthImmediate : public PassiveItem
    4646    {
    47     public:
    48         HealthImmediate(BaseObject* creator);
    49         virtual ~HealthImmediate();
     47        //TODO: Comment.
     48        //Does this get destroyed, when the healt is delivered? It seems to me it doesn't.
     49        public:
     50            HealthImmediate(BaseObject* creator);
     51            virtual ~HealthImmediate();
    5052
    51         virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     53            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    5254
    53         virtual bool pickedUp(Pawn* pawn);
     55            virtual bool pickedUp(Pawn* pawn);
    5456
    55         inline float getRecoveredHealth() const
    56             { return this->recoveredHealth_; }
    57         inline void setRecoveredHealth(float recovery)
    58             { this->recoveredHealth_ = recovery; }
     57            inline float getRecoveredHealth() const
     58                { return this->recoveredHealth_; }
     59            inline void setRecoveredHealth(float recovery)
     60                { this->recoveredHealth_ = recovery; }
    5961
    60     private:
    61         float recoveredHealth_;
     62        private:
     63            float recoveredHealth_;
    6264    };
    6365}
  • code/branches/pickup/src/orxonox/pickup/items/HealthUsable.cc

    r5781 r5902  
    4545
    4646    /**
    47         @brief Constructor
    48         @param creator Object that created this item.
     47    @brief Constructor
     48    @param creator Object that created this item.
    4949    */
    5050    HealthUsable::HealthUsable(BaseObject* creator) : UsableItem(creator)
     
    5454        this->recoveredHealth_ = 0;
    5555    }
     56
    5657    //! Deconstructor
    5758    HealthUsable::~HealthUsable()
    5859    {
    5960    }
     61
    6062    /**
    61         @brief XMLPort for Jump.
    62         @param xmlelement Element of the XML-file.
    63         @param mode XMLPort mode to use.
     63    @brief XMLPort for Jump.
     64    @param xmlelement Element of the XML-file.
     65    @param mode XMLPort mode to use.
    6466    */
    6567    void HealthUsable::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     
    6971        XMLPortParam(HealthUsable, "recoveredHealth", setRecoveredHealth, getRecoveredHealth, xmlelement, mode);
    7072    }
     73
    7174    /**
    72         @brief Called when the item is used, makes the user "jump".
    73         @param pawn Pawn which used te item.
     75    @brief Called when the item is used, makes the user "jump".
     76    @param pawn Pawn which used te item.
    7477    */
     78    //TODO: Jump? Nope! => Comment.
     79    //Should be destroyed anyways.
    7580    void HealthUsable::used(Pawn* pawn)
    7681    {
     
    8590        }
    8691    }
     92
    8793    /**
    88         @brief Called when the item is picked up.
    89         @param pawn Pawn which picked up the item.
     94    @brief Called when the item is picked up.
     95    @param pawn Pawn which picked up the item.
    9096    */
    9197    bool HealthUsable::pickedUp(Pawn* pawn)
     
    9399        return this->addTo(pawn);
    94100    }
     101
    95102    /**
    96         @brief Called when the item is dropped, creates a DroppedItem behind the pawn.
    97         @param pawn Pawn which dropped the item.
     103    @brief Called when the item is dropped, creates a DroppedItem behind the pawn.
     104    @param pawn Pawn which dropped the item.
    98105    */
    99106    bool HealthUsable::dropped(Pawn* pawn)
  • code/branches/pickup/src/orxonox/pickup/items/Jump.h

    r5781 r5902  
    5050    class _OrxonoxExport Jump : public UsableItem
    5151    {
    52     public:
    53         Jump(BaseObject* creator);      //!< Constructor
    54         virtual ~Jump();                //!< Deconstructor
     52        public:
     53            //TODO: Comment. a.s.o.
     54            Jump(BaseObject* creator);      //!< Constructor
     55            virtual ~Jump();                //!< Deconstructor
    5556
    56         virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);  //!< XMLPort
     57            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);  //!< XMLPort
    5758
    58         virtual int getMaxCarryAmount() const
    59             { return INT_MAX; }
     59            virtual int getMaxCarryAmount() const
     60                { return INT_MAX; }
    6061
    61         virtual void used(Pawn* pawn);          //!< Called when the item is used.
     62            virtual void used(Pawn* pawn);          //!< Called when the item is used.
    6263
    63         virtual bool pickedUp(Pawn* pawn);      //!< Called when the item is picked up.
    64         virtual bool dropped(Pawn* pawn);       //!< Called when the item is dropped.
     64            virtual bool pickedUp(Pawn* pawn);      //!< Called when the item is picked up.
     65            virtual bool dropped(Pawn* pawn);       //!< Called when the item is dropped.
    6566
    66         /**
    67             @brief Get the velocity added when the item is used.
    68             @return Returns the added velocity (relative to the Pawn).
    69         */
    70         inline const Vector3& getVelocity() const
    71             { return this->velocity_; }
    72         /**
    73             @brief Set the velocity added when the item is used.
    74             @param velocity New added velocity (relative to Pawn).
    75         */
    76         inline void setVelocity(const Vector3& velocity)
    77             { this->velocity_ = velocity; }
    78         /**
    79             @brief Get the amount of jumps available.
    80             @return Returns how many times the item can be used.
    81         */
    82         inline int getJumpsAvailable() const
    83             { return this->jumpsAvailable_; }
    84         /**
    85             @brief Set the amount of jumps available.
    86             @param num New number of available jumps.
    87         */
    88         inline void setJumpsAvailable(int num)
    89             { this->jumpsAvailable_ = num; }
    90     private:
    91         Vector3 velocity_;      //!< The velocity added when the item is used.
    92         int jumpsAvailable_;    //!< Amount of jumps still available.
     67            /**
     68                @brief Get the velocity added when the item is used.
     69                @return Returns the added velocity (relative to the Pawn).
     70            */
     71            inline const Vector3& getVelocity() const
     72                { return this->velocity_; }
     73            /**
     74                @brief Set the velocity added when the item is used.
     75                @param velocity New added velocity (relative to Pawn).
     76            */
     77            inline void setVelocity(const Vector3& velocity)
     78                { this->velocity_ = velocity; }
     79            /**
     80                @brief Get the amount of jumps available.
     81                @return Returns how many times the item can be used.
     82            */
     83            inline int getJumpsAvailable() const
     84                { return this->jumpsAvailable_; }
     85            /**
     86                @brief Set the amount of jumps available.
     87                @param num New number of available jumps.
     88            */
     89            inline void setJumpsAvailable(int num)
     90                { this->jumpsAvailable_ = num; }
     91        private:
     92            Vector3 velocity_;      //!< The velocity added when the item is used.
     93            int jumpsAvailable_;    //!< Amount of jumps still available.
    9394    };
    9495}
Note: See TracChangeset for help on using the changeset viewer.