- Timestamp:
- Dec 3, 2008, 4:07:49 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickups2/src/orxonox/objects/pickup/ShipEquipment.cc
r2294 r2324 1 1 #include "Item.h" 2 2 #include "ShipEquipment.h" 3 #include "objects/worldentities/pawns/Pawn.h" 3 4 4 5 5 6 namespace orxonox 6 7 { 8 7 9 bool ShipEquipment::insert(Item* item) 8 10 { 9 if(checkSlot(player)==true) 11 if(checkSlot(item)==true) 12 { 10 13 Equipment.insert ( std::pair<std::string, Item*>(item->getName(),item) ); 11 else 14 return true; 15 } 12 16 COUT(3) << "swap?" << std::endl; 17 return false; 13 18 19 return false; 14 20 }; 15 21 bool ShipEquipment::erase (Item* item) 16 22 { 17 if(Equipment.find(item->getName())!= Equipment.end()) 23 std::multimap<std::string,Item*>::iterator it = Equipment.find(item->getName()); 24 if(it != Equipment.end()) 18 25 { 19 std::multimap<std::string,Item*>::iterator it; 20 it=Equipment.find(item->getName()); 26 //it->second->dropped(this->getPlayer()); 21 27 Equipment.erase (it); 22 28 return true; … … 25 31 return false; 26 32 }; 27 bool ShipEquipment::checkSlot(Item* item) const 33 34 void ShipEquipment::eraseAll() 35 { 36 37 for (std::multimap<std::string,Item*>::iterator it = Equipment.begin(); it != Equipment.end(); ) 38 { 39 40 (it++)->second->dropped(this->getPlayer()); 41 } 42 } 43 44 bool ShipEquipment::checkSlot(Item* item) 28 45 { 29 46 std::multimap<std::string,Item*>::iterator it; 30 for ( it= Equipment.begin() ; it != Equipment.end(); it++ )47 for ( it= getPlayer()->getPickUp().getEquipment().begin() ; it != getPlayer()->getPickUp().getEquipment().end(); it++ ) 31 48 { 32 if((*it).second-> playerBaseClass_==item->playerBaseClass_)49 if((*it).second->getPlayerBaseClass()==item->getPlayerBaseClass()) 33 50 return false; 34 51 }
Note: See TracChangeset
for help on using the changeset viewer.