Changeset 6731 for code/trunk/src
- Timestamp:
- Apr 15, 2010, 2:47:39 PM (15 years ago)
- Location:
- code/trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/modules/pickup/PickupCollection.cc
r6540 r6731 176 176 Returns true if the PickupCarrier identified by the input PickupIdentififer it is a target of this PickupCollection, false if not. 177 177 */ 178 bool PickupCollection::isTarget( Identifier* identifier) const178 bool PickupCollection::isTarget(PickupCarrier* carrier) const 179 179 { 180 180 for(std::vector<WeakPtr<Pickupable> >::const_iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++) 181 181 { 182 if(! (*it).get()->isTarget(identifier))182 if(!carrier->isTarget((*it).get())) 183 183 return false; 184 184 } -
code/trunk/src/modules/pickup/PickupCollection.h
r6540 r6731 67 67 virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass. 68 68 69 virtual bool isTarget( Identifier* identifier) const; //!< Get whether a given class, represented by the input Identifier, is a target of this PickupCollection.69 virtual bool isTarget(PickupCarrier* carrier) const; //!< Get whether a given class, represented by the input Identifier, is a target of this PickupCollection. 70 70 71 71 virtual const PickupIdentifier* getPickupIdentifier(void); //!< Get the PickupIdentifier of this PickupCollection. -
code/trunk/src/orxonox/interfaces/Pickupable.cc
r6725 r6731 104 104 bool Pickupable::isTarget(const PickupCarrier* carrier) const 105 105 { 106 if(carrier == NULL) 107 return false; 106 108 return this->isTarget(carrier->getIdentifier()); 107 109 } … … 109 111 /** 110 112 @brief 111 Get whether a given class, represented by the input Identifier,is a target of this Pickupable.112 @param target113 The Identifier of which it has to be determinde whether it is a target of this Pickupable.114 @return 115 Returns true if the given Identifier is a target.116 */ 117 bool Pickupable::isTarget( Identifier* target) const113 Get whether the given Identififer is a target of this Pickupable. 114 @param identifier 115 The PickupCarrier of which it has to be determinde whether it is a target of this Pickupable. 116 @return 117 Returns true if the given PickupCarrier is a target. 118 */ 119 bool Pickupable::isTarget(const Identifier* identifier) const 118 120 { 119 121 //! Iterate through all targets of this Pickupable. 120 122 for(std::list<Identifier*>::const_iterator it = this->targets_.begin(); it != this->targets_.end(); it++) 121 123 { 122 if( target->isA(*it))124 if(identifier->isA(*it)) 123 125 return true; 124 126 } -
code/trunk/src/orxonox/interfaces/Pickupable.h
r6540 r6731 98 98 bool dropped(void); //!< Sets the Pickupable to not picked up or dropped. 99 99 100 bool isTarget(const PickupCarrier* carrier) const; //!< Get whether the given PickupCarrier is a target of this pickup.101 virtual bool isTarget(Identifier* identifier) const; //!< Get whether a given class, represented by the input Identifier, is a target of this Pickupable.100 virtual bool isTarget(const PickupCarrier* carrier) const; //!< Get whether the given PickupCarrier is a target of this pickup. 101 bool isTarget(const Identifier* identifier) const; //!< Get whether a given class, represented by the input Identifier, is a target of this Pickupable. 102 102 bool addTarget(PickupCarrier* target); //!< Add a PickupCarrier as target of this pickup. 103 103 bool addTarget(Identifier* identifier); //!< Add a class, representetd by the input Identifier, as target of this pickup.
Note: See TracChangeset
for help on using the changeset viewer.