- Timestamp:
- Mar 7, 2010, 2:05:05 PM (15 years ago)
- Location:
- code/branches/pickup3/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickup3/src/modules/pickup/Pickup.cc
r6477 r6480 72 72 */ 73 73 void Pickup::initializeIdentifier(void) 74 { 75 //TODO: Check whether this could not be done in the Constructor if Pickupable. Would be much more convenient. 76 this->pickupIdentifier_->addClass(this->getIdentifier()); 77 74 { 78 75 //TODO: Works? 79 76 std::string val1 = this->getActivationType(); -
code/branches/pickup3/src/modules/pickup/PickupCollection.cc
r6475 r6480 53 53 RegisterObject(PickupCollection); 54 54 55 this->pickupCollectionIdentifier_ = new PickupCollectionIdentifier( );55 this->pickupCollectionIdentifier_ = new PickupCollectionIdentifier(this); 56 56 } 57 57 … … 85 85 void PickupCollection::initializeIdentifier(void) 86 86 { 87 this->pickupCollectionIdentifier_->addClass(this->getIdentifier());88 89 87 for(std::vector<Pickupable*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++) 90 88 { -
code/branches/pickup3/src/modules/pickup/PickupCollectionIdentifier.cc
r6475 r6480 34 34 { 35 35 36 PickupCollectionIdentifier::PickupCollectionIdentifier( void)36 PickupCollectionIdentifier::PickupCollectionIdentifier(Pickupable* pickup) : PickupIdentifier(pickup) 37 37 { 38 38 RegisterObject(PickupCollectionIdentifier); -
code/branches/pickup3/src/modules/pickup/PickupCollectionIdentifier.h
r6475 r6480 42 42 43 43 public: 44 PickupCollectionIdentifier( void);44 PickupCollectionIdentifier(Pickupable* pickup); 45 45 ~PickupCollectionIdentifier(); 46 46 -
code/branches/pickup3/src/modules/pickup/items/HealthPickup.cc
r6478 r6480 88 88 void HealthPickup::initializeIdentifier(void) 89 89 { 90 this->pickupIdentifier_->addClass(this->getIdentifier());91 92 90 std::stringstream stream; 93 91 stream << this->getHealth(); -
code/branches/pickup3/src/orxonox/interfaces/Pickupable.cc
r6478 r6480 55 55 this->carrier_ = NULL; 56 56 57 this->pickupIdentifier_ = new PickupIdentifier( );57 this->pickupIdentifier_ = new PickupIdentifier(this); 58 58 } 59 59 -
code/branches/pickup3/src/orxonox/pickup/PickupIdentifier.cc
r6478 r6480 30 30 31 31 #include "core/CoreIncludes.h" 32 #include "interfaces/Pickupable.h" 32 33 33 34 namespace orxonox … … 38 39 Constructor. Registers the object and initializes member variables. 39 40 */ 40 PickupIdentifier::PickupIdentifier( )41 PickupIdentifier::PickupIdentifier(Pickupable* pickup) 41 42 { 42 43 RegisterRootObject(PickupIdentifier); 43 44 44 this-> classIdentifier_ = NULL;45 this->pickup_ = pickup; 45 46 } 46 47 … … 61 62 { 62 63 //! If the classIdentifiers are not the same (meaning the PickupIdentifiers identify different classes), the obviously the two Pickupables identified by the PickupIdentifiers cannot be the same. An ordering is established through the alphabetical ordering of the respective classnames. 63 if(!identifier-> classIdentifier_->isExactlyA(this->classIdentifier_))64 return this-> classIdentifier_->getName().compare(identifier->classIdentifier_->getName());64 if(!identifier->pickup_->getIdentifier()->isExactlyA(this->pickup_->getIdentifier())) 65 return this->pickup_->getIdentifier()->getName().compare(identifier->pickup_->getIdentifier()->getName()); 65 66 66 67 //! If the class is the same for both PickupIdentifiers we go on to check the parameters of the class. … … 86 87 87 88 return false; 88 }89 90 /**91 @brief92 Add the class of the Pickupable to its PickupIdentifier.93 @param identifier94 A pointer to the Identifier of the class.95 */96 void PickupIdentifier::addClass(Identifier* identifier)97 {98 this->classIdentifier_ = identifier;99 89 } 100 90 -
code/branches/pickup3/src/orxonox/pickup/PickupIdentifier.h
r6475 r6480 54 54 55 55 public: 56 PickupIdentifier( void); //!< Constructor.56 PickupIdentifier(Pickupable* pickup); //!< Constructor. 57 57 ~PickupIdentifier(); //!< Destructor. 58 58 59 59 virtual int compare(const PickupIdentifier* identifier) const; //!< Compares two PickupIdentifiers and returns 0 if a == b, <0 if a < b and >0 if a > b for a.compare(b). 60 60 61 void addClass(Identifier* identifier); //!< Add the class of the Pickupable to its PickupIdentifier.62 61 bool addParameter(std::string & name, std::string & value); //!< Add a parameter to the PickupIdentifier. 63 62 64 63 private: 65 Identifier* classIdentifier_; //!< The Identifier of the class.64 Pickupable* pickup_; //!< The Pickupable the PickupIdentififer is for. 66 65 std::map<std::string, std::string> parameters_; //!< The parameters identifying the type of the pickup beyond the class. 67 66
Note: See TracChangeset
for help on using the changeset viewer.