- Timestamp:
- Apr 6, 2009, 3:53:50 PM (16 years ago)
- Location:
- code/branches/pickups
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickups
-
Property
svn:ignore
set to
build
dependencies
-
Property
svn:ignore
set to
-
code/branches/pickups/src/orxonox/objects/pickup/PickupCollection.cc
r2864 r2900 94 94 for (std::multimap<std::string, BaseItem*>::iterator it = this->items_.begin(); it != this->items_.end(); it++) 95 95 { 96 (*it).second->dropped((*it).second->getOwner()); 97 98 delete (*it).second; 96 if((*it).second && (*it).second->getOwner()) 97 (*it).second->dropped((*it).second->getOwner()); 99 98 } 100 99 this->items_.clear(); … … 125 124 return false; 126 125 } 126 } 127 //! Uses the first usable item in the collection on the owner. 128 void PickupCollection::useItem() 129 { 130 Identifier* ident = Class(UsableItem); 131 for (std::multimap<std::string, BaseItem*>::iterator it = this->items_.begin(); it != this->items_.end(); it++) 132 { 133 if ((*it).second->isA(ident)) 134 { 135 UsableItem* asUsable = dynamic_cast<UsableItem*>((*it).second); 136 asUsable->used(this->owner_); 137 return; 138 } 139 } 140 } 141 /** 142 @brief Uses a usable item on the owner of the collection. 143 @param item Item to use. 144 */ 145 void PickupCollection::useItem(UsableItem* item) 146 { 147 if (item && this->owner_) 148 item->used(this->owner_); 127 149 } 128 150 /**
Note: See TracChangeset
for help on using the changeset viewer.