- Timestamp:
- May 23, 2009, 9:53:13 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickups2/src/orxonox/objects/pickup/PickupCollection.cc
r3001 r3016 158 158 return; 159 159 160 bool getNewUsable = false; 160 161 if (item == this->currentUsable_ || (this->currentUsable_ && removeAllOfType && this->currentUsable_->getPickupIdentifier() == item->getPickupIdentifier())) 162 { 163 getNewUsable = true; 164 } 165 166 if (removeAllOfType) 167 { 168 std::multimap<std::string, BaseItem*>::iterator it; 169 while ((it = this->items_.find(item->getPickupIdentifier())) != this->items_.end()) 170 { 171 this->items_.erase(it); 172 } 173 } 174 else 175 { 176 std::multimap<std::string, BaseItem*>::_Pairii bounds = this->items_.equal_range(item->getPickupIdentifier()); 177 for (std::multimap<std::string, BaseItem*>::iterator it = bounds.first; it != bounds.second && it != this->items_.end(); it++) 178 { 179 if ((*it).second == item) 180 { 181 this->items_.erase(it); 182 break; 183 } 184 } 185 } 186 187 if (getNewUsable) 161 188 { 162 189 std::deque<UsableItem*> usables = this->getUsableItems(); … … 166 193 else 167 194 this->currentUsable_ = NULL; 168 } 169 if (removeAllOfType) 170 { 171 std::multimap<std::string, BaseItem*>::iterator it; 172 while ((it = this->items_.find(item->getPickupIdentifier())) != this->items_.end()) 173 { 174 this->items_.erase(it); 175 } 176 } 177 else 178 { 179 std::multimap<std::string, BaseItem*>::_Pairii bounds = this->items_.equal_range(item->getPickupIdentifier()); 180 for (std::multimap<std::string, BaseItem*>::iterator it = bounds.first; it != bounds.second && it != this->items_.end(); it++) 181 { 182 if ((*it).second == item) 183 { 184 this->items_.erase(it); 185 return; 186 } 187 } 195 188 196 } 189 197 }
Note: See TracChangeset
for help on using the changeset viewer.