Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 4, 2008, 9:53:12 PM (15 years ago)
Author:
landauf
Message:

merged changes from pickups1 to pickups2, not merged (probably) accidentally added files

Location:
code/branches/pickups2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pickups2

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/pickups2/src/orxonox/objects/pickup/ShipEquipmentClasses.cc

    r2094 r2136  
    5757                }
    5858                break;
    59             default:;
    6059            }
    6160        case Useable:
    6261            return CheckifSpace();
    63         case default:;
    6462        }
    6563        return true;
     
    9088        }
    9189    }
     90
     91    /*Adds the Item to the Ship*/
     92    void ShipEquipment::AddItem(Shipitem* toAddItem)
     93    {
     94        if(CheckifValid(toAddItem)==true)
     95        {
     96            switch(toAddItem.CheckType()){
     97                case Permanent:
     98                    Equipment.insert ( pair<std::string, ShipItem*>(toAddItem.itemname,toAddItem) );
     99                    break;
     100                case Usable:
     101                    Usable.insert ( pair<std::string, ShipItem*>(toAddItem.itemname,toAddItem) );
     102                    break;
     103                case Trunk:
     104                    Trunk.insert ( pair<std::string, ShipItem*>(toAddItem.itemname,toAddItem) );
     105                    break;
     106            }
     107        }
     108        else if(toAddItem.CheckType()==Permanent)
     109        {
     110            if(CheckifSpace()==true)
     111                Trunk.insert ( pair<std::string, ShipItem*>(toAddItem.itemname,toAddItem) );
     112        }
     113    }
     114
     115    void ShipEquipment::SwitchItem(Permanent* toSwitchItem)
     116    {
     117        multimap<string, ShipItem*>::iterator it;
     118        string equippedname;
     119        equippedname=GetNameofPermanent(toSwitchItem.CheckSubType());
     120        it=Equipment.find(equippedname);
     121        Trunk.insert (find(equippedname));
     122        Equipment.erase (it);
     123        Equipment.insert(pair<std::string, ShipItem*>(toSwitchItem.itemname,toSwitchItem)
     124    }
     125
     126    string ShipEquipment::GetNameofPermanent (subItemTypePermanent NametoGet)
     127    {
     128        multimap<string, ShipItem*>::iterator it;
     129        for ( it=Equipment.begin() ; it != Equipment.end(); it++ ){
     130            if((*it).second->CheckSubType()==NametoGet){
     131                return (*it).first.itemname;
     132            }
     133        }
     134        return 0;
     135    }
    92136}
Note: See TracChangeset for help on using the changeset viewer.