Changeset 6709 for code/trunk/src/orxonox/interfaces
- Timestamp:
- Apr 13, 2010, 9:32:08 AM (15 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/ppspickups1 (added) merged: 6552,6574-6575,6579,6607,6643,6645-6648,6681,6694,6703,6705-6706
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/interfaces/PickupCarrier.h
r6563 r6709 47 47 namespace orxonox 48 48 { 49 50 //! Pre-declarations. 49 class Pickupable; 51 50 class Pickup; 52 51 class HealthPickup; 53 52 class MetaPickup; 53 class SpeedPickup; 54 54 55 55 /** … … 67 67 friend class HealthPickup; 68 68 friend class MetaPickup; 69 69 friend class SpeedPickup; 70 70 71 public: 71 72 PickupCarrier(); //!< Constructor. 72 73 virtual ~PickupCarrier(); //!< Destructor. 73 74 74 75 /** 75 76 @brief Can be called to pick up a Pickupable. … … 87 88 return pickedUp; 88 89 } 89 90 90 91 /** 91 92 @brief Can be called to drop a Pickupable. … … 95 96 */ 96 97 bool drop(Pickupable* pickup, bool drop = true) 97 { 98 { 98 99 bool dropped = this->pickups_.erase(pickup) == 1; 99 100 if(dropped && drop) … … 104 105 return dropped; 105 106 } 106 107 107 108 /** 108 109 @brief Can be used to check whether the PickupCarrier or a child of his is a target ot the input Pickupable. … … 114 115 if(pickup->isTarget(this)) //!< If the PickupCarrier itself is a target. 115 116 return true; 116 117 117 118 //! Go recursively through all children to check whether they are a target. 118 119 std::list<PickupCarrier*>* children = this->getCarrierChildren(); … … 122 123 return true; 123 124 } 124 125 125 126 children->clear(); 126 127 delete children; 127 128 128 129 return false; 129 130 } 130 131 131 132 /** 132 133 @brief Get the carrier that is both a child of the PickupCarrier (or the PickupCarrier itself) and a target of the input Pickupable. … … 138 139 if(!this->isTarget(pickup)) 139 140 return NULL; 140 141 141 142 if(pickup->isTarget(this)) //!< If the PickupCarrier itself is a target. 142 143 return this; 143 144 144 145 //! Go recursively through all children to check whether they are the target. 145 146 std::list<PickupCarrier*>* children = this->getCarrierChildren(); … … 149 150 return *it; 150 151 } 151 152 152 153 children->clear(); 153 154 delete children; 154 155 155 156 return NULL; 156 157 } 157 158 158 159 /** 159 160 @brief Get the (absolute) position of the PickupCarrier. … … 162 163 */ 163 164 virtual const Vector3& getCarrierPosition(void) = 0; 164 165 protected: 165 166 protected: 166 167 /** 167 168 @brief Get all direct children of this PickupSpawner. 168 169 This method needs to be implemented by any direct derivative class of PickupCarrier. 169 170 The returned list will be deleted by the methods calling this function. 170 @return Returns a pointer to a list of all direct children. 171 @return Returns a pointer to a list of all direct children. 171 172 */ 172 173 virtual std::list<PickupCarrier*>* getCarrierChildren(void) = 0; … … 177 178 */ 178 179 virtual PickupCarrier* getCarrierParent(void) = 0; 179 180 180 181 /** 181 182 @brief Get all Pickupables this PickupCarrier has. … … 184 185 std::set<Pickupable*>& getPickups(void) 185 186 { return this->pickups_; } 186 187 187 188 private: 188 189 std::set<Pickupable*> pickups_; //!< The list of Pickupables carried by this PickupCarrier. 189 190 190 191 }; 191 192 }
Note: See TracChangeset
for help on using the changeset viewer.