Changeset 2128 for code/branches/pickups/src/orxonox
- Timestamp:
 - Nov 4, 2008, 12:13:51 PM (17 years ago)
 - Location:
 - code/branches/pickups/src/orxonox/objects/pickup
 - Files:
 - 
          
- 4 edited
 
- 
          ShipEquipmentClasses.cc (modified) (2 diffs)
 - 
          ShipEquipmentClasses.h (modified) (1 diff)
 - 
          ShipItem.cc (modified) (1 diff)
 - 
          ShipItem.h (modified) (1 diff)
 
 
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 }  - 
        
code/branches/pickups/src/orxonox/objects/pickup/ShipEquipmentClasses.h
r2083 r2128 26 26 bool CheckifValid(Shipitem* toBeChecked); 27 27 bool CheckifSpace(); 28 void SwitchItem(Permanent* toSwitchItem); 29 string GetNameofPermanent (subItemTypePermanent NametoGet); //holt den Namen des getragenen Items im jeweiligen Slot. 28 30 private: 29 31 multimap<std::string, ShipItem*> Equipment;  - 
        
code/branches/pickups/src/orxonox/objects/pickup/ShipItem.cc
r2083 r2128 12 12 return this.subtype_permanent; 13 13 } 14 15 subItemTypePowerups CheckSubType() 16 { 17 return this.subtype_powerups; 18 } 19 subItemTypeUsable CheckSubType() 20 { 21 return this.subtype_usables; 22 } 23 14 24 }  - 
        
code/branches/pickups/src/orxonox/objects/pickup/ShipItem.h
r2083 r2128 20 20 public: 21 21 itemType CheckType(); 22 virtual22 //virtual ChecksubType(); 23 23 24 24 private:  
Note: See TracChangeset
          for help on using the changeset viewer.
      


            






