Changeset 6490
- Timestamp:
- Mar 8, 2010, 9:39:47 AM (15 years ago)
- Location:
- code/branches/pickup3/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickup3/src/modules/pickup/items/HealthPickup.cc
r6484 r6490 72 72 */ 73 73 void HealthPickup::initialize(void) 74 { 75 RegisterObject(HealthPickup); 76 74 { 77 75 this->health_ = 0; 78 76 this->healthRate_ = 0; … … 80 78 this->maxHealthSave_ = 0; 81 79 this->maxHealthOverwrite_ = 0; 80 81 this->addTarget(ClassIdentifier<Pawn>::getIdentifier()); 82 82 } 83 83 -
code/branches/pickup3/src/orxonox/interfaces/Pickupable.cc
r6480 r6490 104 104 bool Pickupable::isTarget(const PickupCarrier* carrier) const 105 105 { 106 Identifier* identifier = carrier->getIdentifier(); 106 return this->isTarget(carrier->getIdentifier()); 107 } 108 109 /** 110 @brief 111 Get whether a given class, represented by the input Identifier, is a target of this pickup. 112 @param target 113 The Identifier of which it has to be determinde whether it is a target of this pickup. 114 @return 115 Returns true if the given Identifier is a target. 116 */ 117 bool Pickupable::isTarget(Identifier* target) const 118 { 107 119 //! Iterate through all targets of this Pickupable. 108 120 for(std::list<Identifier*>::const_iterator it = this->targets_.begin(); it != this->targets_.end(); it++) 109 121 { 110 if( identifier->isA(*it))122 if(target->isA(*it)) 111 123 return true; 112 124 } 113 125 return false; 114 126 } 115 127 116 128 /** 117 129 @brief … … 124 136 bool Pickupable::addTarget(PickupCarrier* target) 125 137 { 138 return this->addTarget(target->getIdentifier()); 139 } 140 141 /** 142 @brief 143 Add a class, representetd by the input Identifier, as target of this pickup. 144 @param target 145 The Identifier to be added. 146 @return 147 Returns true if the target was added, false if not. 148 */ 149 bool Pickupable::addTarget(Identifier* target) 150 { 126 151 if(this->isTarget(target)) //!< If the input target is already present in the list of targets. 127 152 return false; 128 153 129 COUT(4) << "Target (&" << target << ")added to Pickupable (&" << this << ")." << std::endl;130 this->targets_.push_back(target ->getIdentifier());154 COUT(4) << "Target " << target->getName() << " added to Pickupable (&" << this << ")." << std::endl; 155 this->targets_.push_back(target); 131 156 return true; 132 157 } -
code/branches/pickup3/src/orxonox/interfaces/Pickupable.h
r6475 r6490 83 83 84 84 bool isTarget(const PickupCarrier* carrier) const; //!< Get whether the given PickupCarrier is a target of this pickup. 85 bool isTarget(Identifier* identifier) const; //!< Get whether a given class, represented by the input Identifier, is a target of this pickup. 85 86 bool addTarget(PickupCarrier* target); //!< Add a PickupCarrier as target of this pickup. 87 bool addTarget(Identifier* identifier); //!< Add a class, representetd by the input Identifier, as target of this pickup. 86 88 87 89 /**
Note: See TracChangeset
for help on using the changeset viewer.