Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7541


Ignore:
Timestamp:
Oct 14, 2010, 12:55:59 PM (14 years ago)
Author:
dafrick
Message:

Some more documentation.

Location:
code/trunk/src/modules/pickup/items
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/modules/pickup/items/DronePickup.cc

    r7163 r7541  
    3333
    3434#include "DronePickup.h"
    35 #include "worldentities/Drone.h"
    36 #include "controllers/DroneController.h"
     35
     36#include <sstream>
    3737
    3838#include "core/CoreIncludes.h"
     
    4040#include "util/StringUtils.h"
    4141
     42#include "controllers/DroneController.h"
     43#include "pickup/PickupIdentifier.h"
    4244#include "worldentities/pawns/Pawn.h"
    43 #include "pickup/PickupIdentifier.h"
    44 
    45 #include <sstream>
     45#include "worldentities/Drone.h"
     46#include "worldentities/StaticEntity.h"
    4647
    4748namespace orxonox
     
    104105    }
    105106
     107    /**
     108    @brief
     109        Set the droneTemplate.
     110    @param templatename
     111        The name of the Template to e set.
     112    */
    106113    void DronePickup::setDroneTemplate(std::string templatename){
    107114        droneTemplate_ = templatename;
    108115    }
    109116
     117    /**
     118    @brief
     119        Get the name of the droneTemplate.
     120    @return
     121        Returns the name of the droneTemplate.
     122    */
    110123    const std::string& DronePickup::getDroneTemplate() const
    111124    {
     
    121134        SUPER(DronePickup, changedUsed);
    122135
    123         //! If the pickup is not picked up nothing must be done.
     136        // If the pickup is not picked up nothing must be done.
    124137        if(!this->isPickedUp())
    125138            return;
    126139
    127         //! If the pickup has transited to used.
     140        // If the pickup has transited to used.
    128141        if(this->isUsed())
    129142        {
    130143
    131144                Pawn* pawn = this->carrierToPawnHelper();
    132                 if(pawn == NULL) //!< If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
     145                if(pawn == NULL) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
    133146                    this->Pickupable::destroy();
    134147
     
    147160                drone->setPosition(spawnPosition);
    148161
    149                 //! The pickup has been used up.
     162                // The pickup has been used up.
    150163                this->setUsed(false);
    151164        }
    152165        else
    153166        {
    154             //! If either the pickup can only be used once or it is continuous and used up, it is destroyed upon setting it to unused.
     167            // If either the pickup can only be used once or it is continuous and used up, it is destroyed upon setting it to unused.
    155168            if(this->isOnce() || (this->isContinuous() ))
    156169            {
  • code/trunk/src/modules/pickup/items/DronePickup.h

    r7456 r7541  
    3939
    4040#include <string>
    41 #include <worldentities/pawns/Pawn.h>
    42 #include <worldentities/Drone.h>
    43 
    44 #include "worldentities/StaticEntity.h"
    4541
    4642#include "pickup/Pickup.h"
     
    4945namespace orxonox {
    5046
     47    /**
     48    @brief
     49        The DronePickup adds a Drone to the Pawn upon being picked up.
     50        It can be used in XML as follows:
     51        @code
     52        <DronePickup droneTemplate="myDroneTemplate" />
     53        @endcode
     54        Where <em>droneTemplate</em> specifies a @ref orxonox::Template "Template" based on which the Drone is created.
    5155
     56    @author
     57        Lukas Gassner
     58
     59    @ingroup PickupItems
     60    */
    5261    class _PickupExport DronePickup : public Pickup, public Tickable
    5362    {
     
    6271            virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass.
    6372
    64             void setDroneTemplate(std::string templatename);
    65             const std::string& getDroneTemplate() const;
     73            void setDroneTemplate(std::string templatename); //!< Set the droneTemplate.
     74            const std::string& getDroneTemplate() const; //!< Get the name of the droneTemplate.
    6675
    6776        protected:
     
    7079        private:
    7180            void initialize(void); //!< Initializes the member variables.
    72             std::string droneTemplate_;
     81            std::string droneTemplate_; //!< The name of the template, based upon which the Drone is created.
    7382            Pawn* carrierToPawnHelper(void); //!< Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails.
    7483
  • code/trunk/src/modules/pickup/items/HealthPickup.cc

    r7163 r7541  
    142142        {
    143143            Pawn* pawn = this->carrierToPawnHelper();
    144             if(pawn == NULL) //!< If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
     144            if(pawn == NULL) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
    145145                this->Pickupable::destroy();
    146146
    147             //! Calculate the health that is added this tick.
     147            // Calculate the health that is added this tick.
    148148            float health = dt*this->getHealthRate();
    149149            if(health > this->getHealth())
    150150                health = this->getHealth();
    151             //! Calculate the health the Pawn will have once the health is added.
     151            // Calculate the health the Pawn will have once the health is added.
    152152            float fullHealth = pawn->getHealth() + health;
    153153            this->setHealth(this->getHealth()-health);
     
    174174            }
    175175
    176             //! If all health has been transfered.
     176            // If all health has been transferred.
    177177            if(this->getHealth() == 0)
    178178            {
     
    190190        SUPER(HealthPickup, changedUsed);
    191191
    192         //! If the pickup is not picked up nothing must be done.
     192        // If the pickup is not picked up nothing must be done.
    193193        if(!this->isPickedUp()) //TODO: Needed?
    194194            return;
    195195
    196         //! If the pickup has transited to used.
     196        // If the pickup has transited to used.
    197197        if(this->isUsed())
    198198        {
     
    200200            {
    201201                Pawn* pawn = this->carrierToPawnHelper();
    202                 if(pawn == NULL) //!< If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
     202                if(pawn == NULL) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
    203203                    this->Pickupable::destroy();
    204204
     
    227227                }
    228228
    229                 //! The pickup has been used up.
     229                // The pickup has been used up.
    230230                this->setUsed(false);
    231231            }
     
    253253            }
    254254
    255             //! If either the pickup can only be used once or it is continuous and used up, it is destroyed upon setting it to unused.
     255            // If either the pickup can only be used once or it is continuous and used up, it is destroyed upon setting it to unused.
    256256            if(this->isOnce() || (this->isContinuous() && this->getHealth() == 0))
    257257            {
  • code/trunk/src/modules/pickup/items/HealthPickup.h

    r7493 r7541  
    4747namespace orxonox {
    4848
    49     //! Enum for the type of the HealthPickup
     49    /**
     50    @brief
     51        Enum for the type of the @ref orxonox::HealthPickup "HealthPickup".
     52
     53    @ingroup PickupItems
     54    */
    5055    namespace pickupHealthType
    5156    {
    5257        enum Value
    5358        {
    54             limited,
    55             temporary,
    56             permanent
     59            limited, //!< Means that the @ref orxonox::HealthPickup "HealthPickup" only increases the users health to its maximum health.
     60            temporary, //!< Means that the @ref orxonox::HealthPickup "HealthPickup" temporarily increases the users health even above its maximum health, but only as long as it is in use.
     61            permanent //!< Means that the @ref orxonox::HealthPickup "HealthPickup" increases the users health even above its maximum health and increases the maximum health permanently such that it matches the new health.
    5762        };
    5863    }
     
    6065    /**
    6166    @brief
    62         A pickup that can do (dependent upon the parameters) lots of different things to the health of a Pawn.
     67        The Health Pickup is a Pickupable that can do (dependent upon the parameters) lots of different things to the health of a Pawn.
    6368        There are 4 parameters that can be chosen:
    64         - The @b health The amount of health that (in a way dependent on the other parameters) is transfered to the Pawn.
    65         - The @b activation @b type It can be chosen to be either 'immediate' or 'onUse'. The activation type essentially (as indicated by the name) defines when the health is transfered, either immediately after being picked up or only after the player uses it.
    66         - The @b duration @b type It can be chosen to be either 'once' or 'continuous'. For 'once' the specified health is transfered once to the Pawn, for 'continuous' the set health is transfered over a span of time at a rate defined by the health rate parameter.
    67         - The @b health @b type The health type can be chosen to be 'limited', 'temporary' or 'permanent'. 'limited' means that the health is increased only to the maximum health of the Pawn. 'temporary' means that the maximum health is temporarily elevated but will be set back as soon as the pickup is no longer in use. 'permanent' means that the maximum health of the Pawn is increased such that the health provided by the pickup will fit in and the maximum health stays that way.
     69        - The <b>health</b> The amount of health that (in a way dependent on the other parameters) is transferred to the Pawn.
     70        - The <b>activation type</b> It can be chosen to be either <em>immediate</em> or <em>onUse</em>. The activation type essentially (as indicated by the name) defines when the health is transferred, either immediately after being picked up or only after the player uses it.
     71        - The <b>duration type</b> It can be chosen to be either <em>once</em> or <em>continuous</em>. For <em>once</em> the specified health is transferred once to the Pawn, for <em>continuous</em> the set health is transferred over a span of time at a rate defined by the health rate parameter.
     72        - The <b>health type</b> The health type can be chosen to be <em>limited</em>, <em>temporary</em> or <em>permanent</em>. <em>limited</em> means that the health is increased only to the maximum health of the Pawn. 'temporary' means that the maximum health is temporarily elevated but will be set back as soon as the pickup is no longer in use. <em>permanent</em> means that the maximum health of the Pawn is increased such that the health provided by the pickup will fit in and the maximum health stays that way.
     73
     74        An examle of a XML implementation of a HealthPickup would be:
     75        @code
     76        <HealthPickup
     77            health = 33
     78            healthType = "limited"
     79            activationType = "immediate"
     80            durationType = "once"
     81        />
     82        @endcode
     83
    6884    @author
    6985        Damian 'Mozork' Frick
     86
     87    @ingroup PickupItems
    7088    */
    7189    class _PickupExport HealthPickup : public Pickup, public Tickable
     
    83101
    84102            /**
    85             @brief Get the health that is transfered to the Pawn upon usage of this pickup.
     103            @brief Get the health that is transferred to the Pawn upon usage of this pickup.
    86104            @return Returns the health.
    87105            */
  • code/trunk/src/modules/pickup/items/InvisiblePickup.cc

    r7208 r7541  
    5757    {
    5858        RegisterObject(InvisiblePickup);
    59         //! Defines who is allowed to pick up the pickup.
    6059        this->initialize();
    6160    }
     
    8685    {
    8786        this->duration_ = 0.0f;
     87        // Defines who is allowed to pick up the pickup.
    8888        this->addTarget(ClassIdentifier<Pawn>::getIdentifier());
    8989    }
     
    9999
    100100        this->initializeIdentifier();
     101        this->setDurationType(Pickup::durationTypeOnce_s); // The duration type is always once.
    101102    }
    102103
     
    109110        SUPER(InvisiblePickup, changedUsed);
    110111
    111         //! If the pickup is not picked up nothing must be done.
     112        // If the pickup is not picked up nothing must be done.
    112113        if(!this->isPickedUp())
    113114            return;
     
    115116        if (this->isUsed())
    116117        {
    117             if(!this->durationTimer_.isActive() && this->durationTimer_.getRemainingTime() > 0.0f)
     118            if(this->isContinuous()
    118119            {
    119                 this->durationTimer_.unpauseTimer();
    120             }
    121             else
    122             {
    123                 this->durationTimer_.setTimer(this->getDuration(), false, createExecutor(createFunctor(&InvisiblePickup::pickupTimerCallback, this)));
     120                if(!this->durationTimer_.isActive() && this->durationTimer_.getRemainingTime() > 0.0f)
     121                {
     122                    this->durationTimer_.unpauseTimer();
     123                }
     124                else
     125                {
     126                    this->durationTimer_.setTimer(this->getDuration(), false, createExecutor(createFunctor(&InvisiblePickup::pickupTimerCallback, this)));
     127                }
    124128            }
    125129
  • code/trunk/src/modules/pickup/items/InvisiblePickup.h

    r7493 r7541  
    5050        A pickup that makes the Pawn invisible.
    5151        There are 2 parameters that can be chosen:
    52         - The @b activation @b type It can be chosen to be either 'immediate' or 'onUse'. The activation type essentially (as indicated by the name) defines when the Pawn will be invisible, either immediately after being picked up or only after the player uses it.
    53         - The @b duration @b type It can be chosen how long the Pawn will be invisibel.
     52        - The <b>activation type</b> It can be chosen to be either <em>immediate</em> or <em>onUse</em>. The activation type essentially (as indicated by the name) defines when the Pawn will be invisible, either immediately after being picked up or only after the player uses it.
     53        - The <b>duration type</b> It can be chosen to be either <em>once</em> or <em>continuous</em>. For <em>once</em> the InvisiblePickup just makes the Pawn invisible for as long as it is used, for <em>continuous</em> the Pawn is invisible for the specified duration.
     54        - The <b>duration</b> Specifies how long (in seconds) the invisibility lasts.
     55
    5456    @author
    5557        Benedict Simlinger
     58
     59    @ingroup PickupItems
    5660    */
    5761    class _PickupExport InvisiblePickup : public Pickup
Note: See TracChangeset for help on using the changeset viewer.