- Timestamp:
- Nov 26, 2008, 7:48:26 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickups2/src/orxonox/objects/pickup/Item.cc
r2227 r2289 29 29 void Item::addTo (Pawn* player) 30 30 { 31 //player->Equipment.insert ( std::pair<std::string, Item*>(this->itemname,this) ); 31 if(checkSlot(player)==true) 32 player->pickUp.Equipment.insert ( std::pair<std::string, Item*>(this->getName(),this) ); 33 else 34 COUT(3) << "swap?" << std::endl; 32 35 } 33 36 bool Item::remove(Pawn* player) 37 { 38 if(player->pickUp.Equipment.find(this->getName())!= player->pickUp.Equipment.end()) 39 { 40 std::multimap<std::string,Item*>::iterator it; 41 it=player->pickUp.Equipment.find(this->getName()); 42 player->pickUp.Equipment.erase (it); 43 return true; 44 } 45 else 46 return false; 47 } 48 bool Item::checkSlot(Pawn* player) 49 { 50 std::multimap<std::string,Item*>::iterator it; 51 for ( it=player->pickUp.Equipment.begin() ; it != player->pickUp.Equipment.end(); it++ ) 52 { 53 if((*it).second->playerBaseClass_==this->playerBaseClass_) 54 return false; 55 } 56 return true; 57 } 34 58 void Item::setPlayerBaseClassName(const std::string& name) 35 59 {
Note: See TracChangeset
for help on using the changeset viewer.