- Timestamp:
- Mar 5, 2010, 6:26:54 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickup3/src/modules/pickup/PickupRepresentation.cc
r6474 r6475 30 30 31 31 #include "core/CoreIncludes.h" 32 #include "graphics/Billboard.h" 33 #include "util/StringUtils.h" 32 34 #include "PickupManager.h" 33 #include "graphics/Billboard.h"34 35 35 36 namespace orxonox … … 38 39 CreateFactory(PickupRepresentation); 39 40 41 /** 42 @brief 43 Constructor. Registers the object and initializes its member variables. 44 This is primarily for use of the PickupManager in creating a default PickupRepresentation. 45 */ 40 46 PickupRepresentation::PickupRepresentation() : BaseObject(this) 41 47 { … … 45 51 } 46 52 53 /** 54 @brief 55 Default Constructor. Registers the object and initializes its member variables. 56 */ 47 57 PickupRepresentation::PickupRepresentation(BaseObject* creator) : BaseObject(creator) 48 58 { … … 52 62 } 53 63 64 /** 65 @brief 66 Destructor. 67 */ 54 68 PickupRepresentation::~PickupRepresentation() 55 69 { 56 70 if(this->spawnerRepresentation_ != NULL) 71 this->spawnerRepresentation_->destroy(); 57 72 } 58 73 74 /** 75 @brief 76 Initializes the member variables of this PickupRepresentation. 77 */ 59 78 void PickupRepresentation::initialize(void) 60 79 { … … 66 85 } 67 86 87 /** 88 @brief 89 Method for creating a PickupRepresentation object through XML. 90 */ 68 91 void PickupRepresentation::XMLPort(Element& xmlelement, XMLPort::Mode mode) 69 92 { … … 76 99 XMLPortObject(PickupRepresentation, StaticEntity, "spawner-representation", setSpawnerRepresentation, getSpawnerRepresentationIndex, xmlelement, mode); 77 100 78 PickupManager::getInstance().registerRepresentation( *this->pickup_->getPickupIdentifier(), this);101 PickupManager::getInstance().registerRepresentation(this->pickup_->getPickupIdentifier(), this); //!< Registers the PickupRepresentation with the PickupManager through the PickupIdentifier of the Pickupable it represents. 79 102 } 80 103 104 /** 105 @brief 106 Get a spawnerRepresentation for a specific PickupSpawner. 107 @param spawner 108 A pointer to the PickupSpawner. 109 @return 110 Returns a pointer to the StaticEntity. 111 */ 81 112 StaticEntity* PickupRepresentation::getSpawnerRepresentation(PickupSpawner* spawner) 82 113 { … … 84 115 { 85 116 COUT(4) << "PickupRepresentation: No spawner representation found." << std::endl; 86 if(this->spawnerTemplate_ == "")117 if(this->spawnerTemplate_ == BLANKSTRING) 87 118 { 88 119 COUT(4) << "PickupRepresentation: Spawner template is empty." << std::endl; 120 //!< If neither spawnerRepresentation nor spawnerTemplate was specified 89 121 return this->getDefaultSpawnerRepresentation(spawner); 90 122 } 91 123 this->addTemplate(this->spawnerTemplate_); 92 124 } 125 93 126 StaticEntity* representation = this->spawnerRepresentation_; 94 127 … … 98 131 } 99 132 133 /** 134 @brief 135 Get the default spawnerRepresentation for a specific PickupSpawner. 136 Helper method of internal use. 137 @param spawner 138 A pointer to the PickupSpawner. 139 @return 140 Returns a pointer to the StaticEntity. 141 */ 142 //TODO: Think of more elegant solution. 100 143 StaticEntity* PickupRepresentation::getDefaultSpawnerRepresentation(PickupSpawner* spawner) 101 144 {
Note: See TracChangeset
for help on using the changeset viewer.