Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 5, 2010, 6:26:54 PM (14 years ago)
Author:
dafrick
Message:

Additional documentation, code niceifying and potential bug fixing. Also: Renamed DroppedItem to DroppedPickup.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pickup3/src/modules/pickup/PickupRepresentation.h

    r6474 r6475  
    3232#include "PickupPrereqs.h"
    3333
     34#include "core/XMLPort.h"
     35#include "interfaces/Pickupable.h"
     36#include "pickup/PickupIdentifier.h"
     37#include "worldentities/StaticEntity.h"
     38#include "PickupSpawner.h"
     39
    3440#include "core/BaseObject.h"
    35 
    36 #include "core/XMLPort.h"
    37 #include "pickup/PickupIdentifier.h"
    38 #include "interfaces/Pickupable.h"
    39 #include "pickup/PickupSpawner.h"
    40 #include "worldentities/StaticEntity.h"
    4141
    4242namespace orxonox
    4343{
    4444
     45    /**
     46    @brief
     47        The PickupRepresentation class represents a specific pickup type (identified by its PickupIdentifier). It defines the information displayed in the GUI and how PickupSpawners that spawn the pickup type look like.
     48        They are created through XML and are registered with the PickupManager.
     49    */
    4550    class _PickupExport PickupRepresentation : public BaseObject
    4651    {
    4752       
    4853        public:
    49             PickupRepresentation();
    50             PickupRepresentation(BaseObject* creator);
    51             virtual ~PickupRepresentation();
     54            PickupRepresentation(); //!< Constructor
     55            PickupRepresentation(BaseObject* creator); //!< Default constructor.
     56            virtual ~PickupRepresentation(); //!< Destructor.
    5257           
    5358            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    5459           
     60            /**
     61            @brief Set the name of the Pickupable represented by this PickupRepresentation.
     62            @param name The name.
     63            */
    5564            inline void setName(const std::string& name)
    5665                { this->name_ = name; }
     66            /**
     67            @brief Set the description of the Pickupable represented by this PickupRepresentation.
     68            @param description The Description.
     69            */
    5770            inline void setDescription(const std::string& description)
    5871                { this->description_ = description; }
     72            /**
     73            @brief Set the spawnerTemplate of the Pickupable represented by this PickupRepresentation.
     74                   The spawnerTemplate is a name of a template defined in XML that defines the StaticEntity that is the spawnerRepresentation of this PickupRepresentation.
     75            @param spawnerTemplate The name of the template.
     76            */
    5977            inline void setSpawnerTemplate(const std::string& spawnerTemplate)
    6078                { this->spawnerTemplate_ = spawnerTemplate; }
     79            /**
     80            @brief Set the StaticEntity that defines how the PickupSpawner of the Pickupable represented by this PickupRepresentation looks like.
     81                   This will be set by the spawnerTemplate. Setting it when creating the PickupRepresentation without creating a template and specifying its name will be futile, because through the course of the game many PickupSpawners for one specific pickup type may have to be created, thus the StaticEntity that is the spawnerRepresentation has to be generated (with the template) for every new PickupSpawner spawning the Pickupable represented by this PickupRepresentation. The spawnerRepresentation that is set here, however can only be used once.
     82            @param representation A pointer to the StaticEntity that is the spawnerRepresentation of this PickupRepresentation.
     83            */
    6184            inline void setSpawnerRepresentation(StaticEntity* representation)
    6285                { this->spawnerRepresentation_ = representation; }
     86            /**
     87            @brief Set the Pickupable that is represented by this PickupRepresentation.
     88            @param pickup A pointer to the Pickupable.
     89            */
    6390            inline void setPickup(Pickupable* pickup)
    6491                { this->pickup_ = pickup; }
    6592               
     93            /**
     94            @brief Get the name of the Pickupable represented by this PickupRepresentation.
     95            @return Returns the name.
     96            */
    6697            inline const std::string& getName(void)
    6798                { return this->name_; }
     99            /**
     100            @brief Get the description of the Pickupable represented by this PickupRepresentation.
     101            @return Returns the description.
     102            */
    68103            inline const std::string& getDescription(void)
    69104                { return this->description_; }
     105            /**
     106            @brief Get the name of spawnerTemplate the Pickupable represented by this PickupRepresentation.
     107            @return Returns the name of the spawnerTemplate.
     108            */
    70109            inline const std::string& getSpawnerTemplate(void)
    71110                { return this->spawnerTemplate_; }
     111            /**
     112            @brief Get the StaticEntity that defines how the PickupSpawner of the Pickupable represented by this PickupRepresentation looks like.
     113            @param index The index.
     114            @return Returns (for index = 0) a pointer to the StaticEntity. For index > 0 it returns NULL.
     115            */
    72116            inline const StaticEntity* getSpawnerRepresentationIndex(unsigned int index)
    73117                { if(index == 0) return this->spawnerRepresentation_; return NULL; }
     118            /**
     119            @brief Get the Pickupable represented by this PickupRepresentation.
     120            @param index The index.
     121            @return Returns (for index = 0) a pointer to the Pickupable. For index > 0 it returns NULL.
     122            */
    74123            inline const Pickupable* getPickup(unsigned int index)
    75124                { if(index == 0) return this->pickup_; return NULL; }
    76125               
    77             StaticEntity* getSpawnerRepresentation(PickupSpawner* spawner);
     126            StaticEntity* getSpawnerRepresentation(PickupSpawner* spawner); //!< Get a spawnerRepresentation for a specific PickupSpawner.
    78127       
    79128        private:
    80             void initialize(void);
    81             StaticEntity* getDefaultSpawnerRepresentation(PickupSpawner* spawner);
     129            void initialize(void); //!< Initializes the member variables of this PickupRepresentation.
     130            StaticEntity* getDefaultSpawnerRepresentation(PickupSpawner* spawner); //!< Get the default spawnerRepresentation for a specific PickupSpawner.
    82131           
    83             std::string name_;
    84             std::string description_;
    85             std::string spawnerTemplate_;
    86             StaticEntity* spawnerRepresentation_;
     132            std::string name_; //!< The name of the Pickupable represented by this PickupRepresentation.
     133            std::string description_; //!< The description of the Pickupable represented by this PickupRepresentation.
     134            std::string spawnerTemplate_; //!<  The name of the template of this PickupRepresentation.
     135            StaticEntity* spawnerRepresentation_; //!< The spawnerRepresentation of this PickupRepresentation.
    87136           
    88             Pickupable* pickup_;
    89            
     137            Pickupable* pickup_; //!< The Pickupable that is represented by this PickupRepresentation.
    90138           
    91139    };
Note: See TracChangeset for help on using the changeset viewer.