Changeset 9348 for code/trunk/src/orxonox/interfaces
- Timestamp:
- Aug 30, 2012, 11:08:17 PM (12 years ago)
- Location:
- code/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:ignore
-
old new 1 .project 1 2 build 2 3 codeblocks 4 dependencies 3 5 vs 4 dependencies
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
code/trunk/src/orxonox/interfaces/Pickupable.cc
r8866 r9348 39 39 40 40 #include "infos/PlayerInfo.h" 41 #include "pickup/PickupIdentifier.h"42 41 #include "worldentities/pawns/Pawn.h" 43 42 … … 52 51 Constructor. Registers the objects and initializes its member variables. 53 52 */ 54 Pickupable::Pickupable() : pickupIdentifier_(NULL),used_(false), pickedUp_(false)53 Pickupable::Pickupable() : used_(false), pickedUp_(false) 55 54 { 56 55 RegisterRootObject(Pickupable); … … 58 57 this->carrier_ = NULL; 59 58 60 this->pickupIdentifier_ = new PickupIdentifier(this);61 59 this->beingDestroyed_ = false; 62 60 this->enabled_ = true; … … 69 67 Pickupable::~Pickupable() 70 68 { 71 if(this->pickupIdentifier_ != NULL)72 {73 orxout(verbose, context::pickups) << "Pickupable (&" << this << ") destroyed." << endl;74 this->pickupIdentifier_->destroy();75 }76 69 } 77 70 … … 104 97 void Pickupable::destroyPickup(void) 105 98 { 106 if(!this-> beingDestroyed_)99 if(!this->isBeingDestroyed()) 107 100 this->OrxonoxClass::destroy(); 108 101 else … … 329 322 /** 330 323 @brief 331 Creates a duplicate of the Pickupable.332 @return333 Returns the clone of this pickup as a pointer to a Pickupable.334 */335 Pickupable* Pickupable::clone(void)336 {337 OrxonoxClass* item = NULL;338 this->clone(item);339 340 Pickupable* pickup = dynamic_cast<Pickupable*>(item);341 342 orxout(verbose, context::pickups) << "Pickupable (&" << this << ") cloned. Clone is new Pickupable (&" << pickup << ")." << endl;343 return pickup;344 }345 346 /**347 @brief348 324 Method to transcribe a Pickupable as a Rewardable to the player. 349 325 @param player -
code/trunk/src/orxonox/interfaces/Pickupable.h
r8866 r9348 53 53 Pickups (@ref orxonox::Pickupable "Pickupables") are objects that (quite unsurprisingly) can be picked up. Additionally they can be used and unused (transition from used to not used), and also dropped. 54 54 55 A class of Pickups can incorporate many different types of pickups (see @ref orxonox::PickupIdentifier "PickupIdentifier"), each type is uniquely defined by a @ref orxonox::PickupIdentifier "PickupIdentifier". Each pickup has such an identifier identiying its type. This means that two pickups of the same type have identifiers which are equal.56 57 55 @author 58 56 Damian 'Mozork' Frick … … 69 67 public: 70 68 virtual ~Pickupable(); //!< Default destructor. 69 70 //! @brief Returns the representation name which refers to the name of the PickupRepresentation that is used to represent this pickup. 71 virtual const std::string& getRepresentationName() const = 0; 71 72 72 73 /** … … 136 137 bool addTarget(Identifier* identifier); //!< Add a class, representetd by the input Identifier, as target of this Pickupable. 137 138 138 Pickupable* clone(void); //!< Creates a duplicate of the Pickupable.139 /**140 @brief Creates a duplicate of the input OrxonoxClass.141 This method needs to be implemented by any Class inheriting from Pickupable.142 @param item A reference to a pointer to the OrxonoxClass that is to be duplicated.143 */144 virtual void clone(OrxonoxClass*& item) {}145 146 /**147 @brief Get the PickupIdentifier of this Pickupable.148 @return Returns a pointer to the PickupIdentifier of this Pickupable.149 */150 virtual const PickupIdentifier* getPickupIdentifier(void) const151 { return this->pickupIdentifier_; }152 153 139 bool setUsed(bool used); //!< Sets the Pickupable to used or unused, depending on the input. 154 140 bool setPickedUp(bool pickedUp); //!< Helper method to set the Pickupable to either picked up or not picked up. … … 158 144 159 145 protected: 160 /**161 @brief Helper method to initialize the PickupIdentifier.162 */163 void initializeIdentifier(void) {}164 165 146 virtual void preDestroy(void); //!< A method that is called by OrxonoxClass::destroy() before the object is actually destroyed. 166 147 virtual void destroyPickup(void); //!< Destroys a Pickupable. … … 174 155 175 156 /** 157 @brief Check whether the Pickupable is in the process of being destroyed. 158 @return Returns true if so. 159 */ 160 inline bool isBeingDestroyed(void) 161 { return this->beingDestroyed_; } 162 163 /** 176 164 @brief Facilitates the creation of a PickupSpawner upon dropping of the Pickupable. 177 This method must be implemented by any class directly inheriting from Pickupable. It is most easily done by just creating a new DroppedPickup, e.g.: 178 DroppedPickup(BaseObject* creator, Pickupable* pickup, PickupCarrier* carrier, float triggerDistance); 165 This method must be implemented by any class directly inheriting from Pickupable. 179 166 @return Returns true if a spawner was created, false if not. 180 167 */ 181 168 virtual bool createSpawner(void) = 0; 182 183 PickupIdentifier* pickupIdentifier_; //!< The PickupIdentifier of this Pickupable.184 169 185 170 private: … … 203 188 //! SUPER functions. 204 189 SUPER_FUNCTION(10, Pickupable, changedUsed, false); 205 SUPER_FUNCTION(12, Pickupable, changedCarrier, false); 206 SUPER_FUNCTION(13, Pickupable, changedPickedUp, false); 207 SUPER_FUNCTION(11, Pickupable, clone, false); 190 SUPER_FUNCTION(11, Pickupable, changedCarrier, false); 191 SUPER_FUNCTION(12, Pickupable, changedPickedUp, false); 208 192 } 209 193 -
code/trunk/src/orxonox/interfaces/RadarViewable.h
r9257 r9348 61 61 virtual ~RadarViewable(); 62 62 63 64 65 66 67 68 69 70 71 72 63 virtual void setRadarName(const std::string& name) 64 { 65 if (this->radarName_ != name) 66 { 67 this->radarName_ = name; 68 this->settingsChanged(); 69 } 70 } 71 const std::string& getRadarName() const 72 { return this->radarName_; } 73 73 74 74 inline void setRadarObjectCamouflage(float camouflage) … … 163 163 ColourValue radarObjectColour_; 164 164 float scale_; 165 165 std::string radarName_; 166 166 }; 167 167 }
Note: See TracChangeset
for help on using the changeset viewer.