- Timestamp:
- Nov 4, 2008, 12:13:51 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickups/src/orxonox/objects/pickup/ShipEquipmentClasses.cc
r2055 r2128 63 63 switch(toAddItem.CheckType()){ 64 64 case Permanent: 65 Equipment.insert ( pair<std::string, ShipItem*>(toAddItem.itemname, *toAddItem) );65 Equipment.insert ( pair<std::string, ShipItem*>(toAddItem.itemname,toAddItem) ); 66 66 break; 67 67 case Usable: 68 Usable.insert ( pair<std::string, ShipItem*>(toAddItem.itemname, *toAddItem) );68 Usable.insert ( pair<std::string, ShipItem*>(toAddItem.itemname,toAddItem) ); 69 69 break; 70 70 case Trunk: 71 Trunk.insert ( pair<std::string, ShipItem*>(toAddItem.itemname, *toAddItem) );71 Trunk.insert ( pair<std::string, ShipItem*>(toAddItem.itemname,toAddItem) ); 72 72 break; 73 73 } … … 76 76 else if(toAddItem.CheckType()==Permanent){ 77 77 if(CheckifSpace()==true) 78 Trunk.insert ( pair<std::string, ShipItem*>(toAddItem.itemname, *toAddItem) );78 Trunk.insert ( pair<std::string, ShipItem*>(toAddItem.itemname,toAddItem) ); 79 79 80 80 } 81 81 82 82 } 83 84 void SwitchItem(Permanent* toSwitchItem){ 85 multimap<string, ShipItem*>::iterator it; 86 string equippedname; 87 equippedname=GetNameofPermanent(toSwitchItem.CheckSubType()); 88 it=Equipment.find(equippedname); 89 Trunk.insert (find(equippedname)); 90 Equipment.erase (it); 91 Equipment.insert(pair<std::string, ShipItem*>(toSwitchItem.itemname,toSwitchItem) 92 93 } 94 95 string GetNameofPermanent (subItemTypePermanent NametoGet){ 96 multimap<string, ShipItem*>::iterator it; 97 for ( it=Equipment.begin() ; it != Equipment.end(); it++ ){ 98 if((*it).second->CheckSubType()==NametoGet){ 99 return (*it).first.itemname; 100 } 101 102 } 103 return 0; 104 }
Note: See TracChangeset
for help on using the changeset viewer.