Changeset 6607 for code/branches/ppspickups1/src/orxonox/interfaces
- Timestamp:
- Mar 22, 2010, 10:45:09 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/ppspickups1/src/orxonox/interfaces/PickupCarrier.h
r6540 r6607 48 48 { 49 49 50 //! Pre-declarations.51 class Pickup;52 class HealthPickup;53 class MetaPickup;54 55 50 /** 56 51 @brief … … 66 61 friend class HealthPickup; 67 62 friend class MetaPickup; 68 63 friend class SpeedPickup; 64 69 65 public: 70 66 PickupCarrier(); //!< Constructor. 71 67 virtual ~PickupCarrier(); //!< Destructor. 72 68 73 69 /** 74 70 @brief Can be called to pick up a Pickupable. … … 86 82 return pickedUp; 87 83 } 88 84 89 85 /** 90 86 @brief Can be called to drop a Pickupable. … … 94 90 */ 95 91 bool drop(Pickupable* pickup, bool drop = true) 96 { 92 { 97 93 bool dropped = this->pickups_.erase(pickup) == 1; 98 94 if(dropped && drop) … … 103 99 return dropped; 104 100 } 105 101 106 102 /** 107 103 @brief Can be used to check whether the PickupCarrier or a child of his is a target ot the input Pickupable. … … 113 109 if(pickup->isTarget(this)) //!< If the PickupCarrier itself is a target. 114 110 return true; 115 111 116 112 //! Go recursively through all children to check whether they are a target. 117 113 std::list<PickupCarrier*>* children = this->getCarrierChildren(); … … 121 117 return true; 122 118 } 123 119 124 120 children->clear(); 125 121 delete children; 126 122 127 123 return false; 128 124 } 129 125 130 126 /** 131 127 @brief Get the carrier that is both a child of the PickupCarrier (or the PickupCarrier itself) and a target of the input Pickupable. … … 137 133 if(!this->isTarget(pickup)) 138 134 return NULL; 139 135 140 136 if(pickup->isTarget(this)) //!< If the PickupCarrier itself is a target. 141 137 return this; 142 138 143 139 //! Go recursively through all children to check whether they are the target. 144 140 std::list<PickupCarrier*>* children = this->getCarrierChildren(); … … 148 144 return *it; 149 145 } 150 146 151 147 children->clear(); 152 148 delete children; 153 149 154 150 return NULL; 155 151 } 156 152 157 153 /** 158 154 @brief Get the (absolute) position of the PickupCarrier. … … 161 157 */ 162 158 virtual const Vector3& getCarrierPosition(void) = 0; 163 164 protected: 159 160 protected: 165 161 /** 166 162 @brief Get all direct children of this PickupSpawner. 167 163 This method needs to be implemented by any direct derivative class of PickupCarrier. 168 164 The returned list will be deleted by the methods calling this function. 169 @return Returns a pointer to a list of all direct children. 165 @return Returns a pointer to a list of all direct children. 170 166 */ 171 167 virtual std::list<PickupCarrier*>* getCarrierChildren(void) = 0; … … 176 172 */ 177 173 virtual PickupCarrier* getCarrierParent(void) = 0; 178 174 179 175 /** 180 176 @brief Get all Pickupables this PickupCarrier has. … … 183 179 std::set<Pickupable*>& getPickups(void) 184 180 { return this->pickups_; } 185 181 186 182 private: 187 183 std::set<Pickupable*> pickups_; //!< The list of Pickupables carried by this PickupCarrier. 188 184 189 185 }; 190 186 }
Note: See TracChangeset
for help on using the changeset viewer.