Changeset 6419 for code/branches/pickup3/src/orxonox/pickup/BaseItem.h
- Timestamp:
- Dec 25, 2009, 11:07:09 PM (15 years ago)
- Location:
- code/branches/pickup3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickup3
- Property svn:mergeinfo changed
/code/branches/pickup2 (added) merged: 5942,5947,5953,6405
- Property svn:mergeinfo changed
-
code/branches/pickup3/src/orxonox/pickup/BaseItem.h
r5781 r6419 44 44 { 45 45 /** 46 47 46 @brief 47 Base class for all items/pickups. 48 48 49 50 51 49 Provides common methods to be used in derived classes. 50 @author 51 Daniel 'Huty' Haggenmueller 52 52 */ 53 53 class _OrxonoxExport BaseItem : public BaseObject 54 54 { 55 55 // tolua_end 56 public:57 BaseItem(BaseObject* creator);58 virtual ~BaseItem();56 public: 57 BaseItem(BaseObject* creator); 58 virtual ~BaseItem(); 59 59 60 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< XMLPort60 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< XMLPort 61 61 62 /**62 /** 63 63 @brief Checks how many instances of this item can be carried at a time. 64 64 @return How many of this item can be carried. 65 */66 virtual int getMaxCarryAmount() const67 { return 1; }65 */ 66 virtual int getMaxCarryAmount() const //TODO: Maybe, better to just be virtual. 67 { return BaseItem::MAX_CARRY_AMOUNT; } 68 68 69 bool addTo(Pawn* pawn); //!< Add the item to a pawn. 70 bool removeFrom(Pawn* pawn); //!< Removes the item from a pawn. 71 /** 69 //TODO: Need to be public? 70 bool addTo(Pawn* pawn); //!< Add the item to a pawn. 71 bool removeFrom(Pawn* pawn); //!< Removes the item from a pawn. 72 /** 72 73 @brief 73 74 Method invoked when the item gets picked up. … … 78 79 @param pawn Pawn who picks up the item. 79 80 @return Returns whether the pawn was able to pick up the item. 80 */81 virtual bool pickedUp(Pawn* pawn)82 { return false; }83 /**81 */ 82 virtual bool pickedUp(Pawn* pawn) //TODO: Maybe better to be just virtual. 83 { return false; } 84 /** 84 85 @brief 85 86 Method invoked when the item is dropped from a player. … … 90 91 @param pawn Pawn which dropped the item. 91 92 @return Returns whether the item was able to get dropped by the pawn. 92 */93 virtual bool dropped(Pawn* pawn)94 { return false; }93 */ 94 virtual bool dropped(Pawn* pawn) 95 { return false; } 95 96 96 /**97 /** 97 98 @brief Gets the current owner of the pickup. 98 99 @return Returns the current owner. 99 */100 inline Pawn* getOwner() const101 { return this->owner_; }102 /**100 */ 101 inline Pawn* getOwner() const 102 { return this->owner_; } 103 /** 103 104 @brief Sets the owner of the pickup. 104 105 @param owner New owner for the pickup. 105 */106 inline void setOwner(Pawn* owner)107 { this->owner_ = owner; }106 */ 107 inline void setOwner(Pawn* owner) 108 { this->owner_ = owner; } 108 109 109 /**110 /** 110 111 @brief Gets the pickupIdentifier of the item. 111 112 @return Returns the pickupIdentifier of the item. 112 113 @see pickupIdentifier_ 113 */114 inline const std::string& getPickupIdentifier() const115 { return this->pickupIdentifier_; }116 /**114 */ 115 inline const std::string& getPickupIdentifier() const 116 { return this->pickupIdentifier_; } 117 /** 117 118 @brief Sets the pickupIdentifier for the item. 118 119 @param identifier New pickupIdentifier for the item. 119 120 @see pickupIdentifier_ 120 */ 121 inline void setPickupIdentifier(const std::string& identifier) 122 { this->pickupIdentifier_ = identifier; } 121 */ 122 //TODO: Needs to be public? 123 inline void setPickupIdentifier(const std::string& identifier) 124 { this->pickupIdentifier_ = identifier; } 123 125 124 // GUI stuff 125 virtual const std::string& getGUIText() const; // tolua_export 126 inline void setGUIText(const std::string& text) 127 { this->guiText_ = text; } 126 // GUI stuff 127 //TODO: Comment. Maybe seperate GUI from Pickup, e.g. ItemDescription... 128 virtual const std::string& getGUIText() const; // tolua_export 129 inline void setGUIText(const std::string& text) 130 { this->guiText_ = text; } 128 131 129 virtual const std::string& getGUIImage() const130 { return this->guiImage_; }131 inline void setGUIImage(const std::string& image)132 { this->guiImage_ = image; }133 private:134 Pawn* owner_; //!< The current owner of the item.132 virtual const std::string& getGUIImage() const 133 { return this->guiImage_; } 134 inline void setGUIImage(const std::string& image) 135 { this->guiImage_ = image; } 136 private: 137 static const int MAX_CARRY_AMOUNT = 1; 135 138 136 /** 139 Pawn* owner_; //!< The current owner of the item. 140 141 /** 137 142 @brief 138 143 The pickupIdentifier of the item.. … … 140 145 Usually set to the template name used by a PickupSpawner, 141 146 used to index items in the PickupCollection. 142 */143 std::string pickupIdentifier_;147 */ 148 std::string pickupIdentifier_; //TODO: Remove, when always just this->getName(). 144 149 145 std::string guiText_; 146 std::string guiImage_; 150 //TODO: Comment. 151 std::string guiText_; 152 std::string guiImage_; 147 153 }; // tolua_export 148 154 } // tolua_export
Note: See TracChangeset
for help on using the changeset viewer.