Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/lastmanstanding/src/modules/pickup/PickupRepresentation.h @ 7698

Last change on this file since 7698 was 7456, checked in by dafrick, 14 years ago

Reviewing documentation fo Questsystem, moving documentation fully into doxygen.
Added some files to modules they belong to.

  • Property svn:eol-style set to native
File size: 7.9 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      Damian 'Mozork' Frick
24 *   Co-authors:
25 *      ...
26 *
27*/
28
29/**
30    @file PickupRepresentation.h
31    @brief Definition of the PickupRepresentation class.
32    @ingroup Pickup
33*/
34
35#ifndef _PickupRepresentation_H__
36#define _PickupRepresentation_H__
37
38#include "PickupPrereqs.h"
39
40#include "core/XMLPort.h"
41#include "interfaces/Pickupable.h"
42#include "pickup/PickupIdentifier.h"
43#include "worldentities/StaticEntity.h"
44#include "PickupSpawner.h"
45
46#include "core/BaseObject.h"
47
48namespace orxonox // tolua_export
49{ // tolua_export
50
51    /**
52    @brief
53        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.
54        They are created through XML and are registered with the PickupManager.
55    */
56    class _PickupExport PickupRepresentation // tolua_export
57        : public BaseObject
58    { // tolua_export
59
60        public:
61            PickupRepresentation(); //!< Constructor
62            PickupRepresentation(BaseObject* creator); //!< Default constructor.
63            virtual ~PickupRepresentation(); //!< Destructor.
64
65            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
66
67            /**
68            @brief Set the name of the Pickupable represented by this PickupRepresentation.
69            @param name The name.
70            */
71            inline void setPickupName(const std::string& name)
72                { this->name_ = name; }
73            /**
74            @brief Set the description of the Pickupable represented by this PickupRepresentation.
75            @param description The Description.
76            */
77            inline void setPickupDescription(const std::string& description)
78                { this->description_ = description; }
79            /**
80            @brief Set the spawnerTemplate of the Pickupable represented by this PickupRepresentation.
81                   The spawnerTemplate is a name of a template defined in XML that defines the StaticEntity that is the spawnerRepresentation of this PickupRepresentation.
82            @param spawnerTemplate The name of the template.
83            */
84            inline void setSpawnerTemplate(const std::string& spawnerTemplate)
85                { this->spawnerTemplate_ = spawnerTemplate; }
86            /**
87            @brief Set the StaticEntity that defines how the PickupSpawner of the Pickupable represented by this PickupRepresentation looks like.
88                   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.
89            @param representation A pointer to the StaticEntity that is the spawnerRepresentation of this PickupRepresentation.
90            */
91            inline void setSpawnerRepresentation(StaticEntity* representation)
92                { this->spawnerRepresentation_ = representation; }
93            /**
94            @brief Set the image representing the pickup in the PickupInventory.
95            @param image A string with the name of the image representing the pickup.
96            */
97            inline void setInventoryRepresentation(const std::string& image)
98                { this->inventoryRepresentation_ = image; }
99            /**
100            @brief Set the Pickupable that is represented by this PickupRepresentation.
101            @param pickup A pointer to the Pickupable.
102            */
103            inline void setPickup(Pickupable* pickup)
104                { this->pickup_ = pickup; }
105
106            /**
107            @brief Get the name of the Pickupable represented by this PickupRepresentation.
108            @return Returns the name.
109            */
110            inline const std::string& getPickupName(void) { return this->name_; } // tolua_export
111            /**
112            @brief Get the description of the Pickupable represented by this PickupRepresentation.
113            @return Returns the description.
114            */
115            inline const std::string& getPickupDescription(void) { return this->description_; } // tolua_export
116            /**
117            @brief Get the name of spawnerTemplate the Pickupable represented by this PickupRepresentation.
118            @return Returns the name of the spawnerTemplate.
119            */
120            inline const std::string& getSpawnerTemplate(void)
121                { return this->spawnerTemplate_; }
122            /**
123            @brief Get the StaticEntity that defines how the PickupSpawner of the Pickupable represented by this PickupRepresentation looks like.
124            @param index The index.
125            @return Returns (for index = 0) a pointer to the StaticEntity. For index > 0 it returns NULL.
126            */
127            inline const StaticEntity* getSpawnerRepresentationIndex(unsigned int index)
128                { if(index == 0) return this->spawnerRepresentation_; return NULL; }
129            /**
130            @brief Get the name of the image representing the pickup in the PickupInventory.
131            @return Returns the name of the image as a string.
132            */
133            inline const std::string& getInventoryRepresentation(void) { return this->inventoryRepresentation_; } // tolua_export
134            /**
135            @brief Get the Pickupable represented by this PickupRepresentation.
136            @param index The index.
137            @return Returns (for index = 0) a pointer to the Pickupable. For index > 0 it returns NULL.
138            */
139            inline const Pickupable* getPickup(unsigned int index)
140                { if(index == 0) return this->pickup_; return NULL; }
141
142            StaticEntity* getSpawnerRepresentation(PickupSpawner* spawner); //!< Get a spawnerRepresentation for a specific PickupSpawner.
143
144        private:
145            void initialize(void); //!< Initializes the member variables of this PickupRepresentation.
146            StaticEntity* getDefaultSpawnerRepresentation(PickupSpawner* spawner); //!< Get the default spawnerRepresentation for a specific PickupSpawner.
147
148            std::string name_; //!< The name of the Pickupable represented by this PickupRepresentation.
149            std::string description_; //!< The description of the Pickupable represented by this PickupRepresentation.
150            std::string spawnerTemplate_; //!<  The name of the template of this PickupRepresentation.
151            StaticEntity* spawnerRepresentation_; //!< The spawnerRepresentation of this PickupRepresentation.
152            std::string inventoryRepresentation_; //!< The name of an image representing the pickup in the PickupInventory.
153
154            Pickupable* pickup_; //!< The Pickupable that is represented by this PickupRepresentation.
155
156    }; // tolua_export
157
158} // tolua_export
159
160#endif // _PickupRepresentation_H__
Note: See TracBrowser for help on using the repository browser.