Changeset 9314 for code/branches/presentation2012merge/src/orxonox
- Timestamp:
- Jul 8, 2012, 6:31:46 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2012merge/src/orxonox/pickup/PickupIdentifier.cc
r9305 r9314 76 76 77 77 // If the classIdentifiers are not the same (meaning the PickupIdentifiers identify different classes), then obviously the two Pickupables identified by the PickupIdentifiers cannot be the same. An ordering is established through the alphabetical ordering of the respective classnames. 78 if( !identifier->pickup_->getIdentifier()->isExactlyA(this->pickup_->getIdentifier()))78 if(identifier->pickup_->getIdentifier() != this->pickup_->getIdentifier()) 79 79 return this->pickup_->getIdentifier()->getName().compare(identifier->pickup_->getIdentifier()->getName()); 80 80 81 81 // If the class is the same for both PickupIdentifiers we go on to check the parameters of the class. 82 82 // If the two have a different number of parameters then obviously something is very wrong. 83 if( !(this->parameters_.size() == identifier->parameters_.size()))83 if(this->parameters_.size() != identifier->parameters_.size()) 84 84 { 85 85 orxout(internal_error, context::pickups) << "Two PickupIdentifiers of the same Class have a different number of parameters. " << this->parameters_.size() << " vs. " << identifier->parameters_.size() << ". This indicates a bug in " << this->pickup_->getIdentifier()->getName() << "." << endl; … … 87 87 } 88 88 89 // We iterate through all parameters and compare their values (which are strings). The first parameter is the most significant. The ordering is once again established by the alphabetical comparison of the two value strings. 90 for(std::map<std::string, std::string>::const_iterator it = this->parameters_.begin(); it != this->parameters_.end(); it++) 89 // We iterate through all parameters and compare their values (which are strings). The ordering is once again established by the alphabetical comparison of the two value strings. 90 std::map<std::string, std::string>::const_iterator it1 = this->parameters_.begin(); 91 std::map<std::string, std::string>::const_iterator it2 = identifier->parameters_.begin(); 92 for( ; it1 != this->parameters_.end(); ++it1, ++it2) 91 93 { 92 94 // If a parameter present in one of the identifiers is not found in the other, once again, something is very wrong. 93 if(i dentifier->parameters_.find(it->first) == identifier->parameters_.end())95 if(it1->first != it2->first) 94 96 { 95 97 orxout(internal_error, context::pickups) << this->pickup_->getIdentifier()->getName() << " Something went wrong in PickupIdentifier!" << endl; 96 return -1;98 return it1->first.compare(it2->first); 97 99 } 98 if(identifier->parameters_.find(it->first)->second != it->second) 99 return it->second.compare(identifier->parameters_.find(it->first)->second); 100 101 int result = it1->second.compare(it2->second); 102 if(result != 0) 103 return result; 100 104 } 101 105
Note: See TracChangeset
for help on using the changeset viewer.