- Timestamp:
- Jun 18, 2010, 8:54:01 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation3/src/orxonox/interfaces/PickupCarrier.h
r7129 r7150 81 81 82 82 /** 83 @brief Can be called to pick up a Pickupable.84 @param pickup A pointer to the Pickupable.85 @return Returns true if the Pickupable was picked up, false if not.86 */87 bool pickup(Pickupable* pickup)88 {89 bool pickedUp = this->pickups_.insert(pickup).second;90 if(pickedUp)91 {92 COUT(4) << "Picked up Pickupable " << pickup->getIdentifier()->getName() << "(&" << pickup << ")." << std::endl;93 pickup->pickedUp(this);94 }95 return pickedUp;96 }97 98 /**99 @brief Can be called to drop a Pickupable.100 @param pickup A pointer to the Pickupable.101 @param drop If the Pickupable should just be removed from the PickupCarrier without further action, this can be set to false. true is default.102 @return Returns true if the Pickupable has been dropped, false if not.103 */104 bool drop(Pickupable* pickup, bool drop = true)105 {106 bool dropped = this->pickups_.erase(pickup) == 1;107 if(dropped && drop)108 {109 COUT(4) << "Dropping Pickupable " << pickup->getIdentifier()->getName() << "(&" << pickup << ")." << std::endl;110 pickup->dropped();111 }112 return dropped;113 }114 115 /**116 83 @brief Can be used to check whether the PickupCarrier or a child of his is a target ot the input Pickupable. 117 84 @param pickup A pointer to the Pickupable. … … 193 160 194 161 /** 162 @brief Adds a Pickupable to the list of pickups that are carried by this PickupCarrier. 163 @param pickup A pointer to the pickup to be added. 164 @return Returns true if successfull, false if the Pickupable was already present. 165 */ 166 bool addPickup(Pickupable* pickup) 167 { return this->pickups_.insert(pickup).second; } 168 169 /** 170 @brief Removes a Pickupable from the list of pickups that are carried by thsi PickupCarrier. 171 @param pickup A pointer to the pickup to be removed. 172 @return Returns true if successfull, false if the Pickupable was not present in the list. 173 */ 174 bool removePickup(Pickupable* pickup) 175 { return this->pickups_.erase(pickup) == 1; } 176 177 /** 195 178 @brief Get all Pickupables this PickupCarrier has. 196 179 @return Returns the set of all Pickupables this PickupCarrier has.
Note: See TracChangeset
for help on using the changeset viewer.