Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 27, 2008, 3:40:01 PM (15 years ago)
Author:
dsommer
Message:

shipeq private matter…

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pickups2/src/orxonox/objects/pickup/ShipEquipment.cc

    r2289 r2290  
    44namespace orxonox
    55{
    6         ShipEquipmentClass::int getSpace()
     6        bool insert(Item* item)
    77        {
    8         return Usable.size()+Trunk.size();
     8        if(checkSlot(player)==true)
     9                Equipment.insert ( std::pair<std::string, Item*>(item->getName(),item) );
     10        else
     11                COUT(3) << "swap?" << std::endl;
     12       
     13
     14
     15
     16
     17        };
     18        bool erase (Item* item)
     19        {
     20        if(Equipment.find(item->getName())!= Equipment.end())
     21        {
     22                std::multimap<std::string,Item*>::iterator it;
     23                it=Equipment.find(item->getName());
     24                Equipment.erase (it);
     25                return true;
     26        }
     27        else
     28                return false;
     29        };
     30        bool checkSlot(Item* item) const
     31        {
     32        std::multimap<std::string,Item*>::iterator it;
     33        for ( it=Equipment.begin() ; it != Equipment.end(); it++ )
     34        {
     35                if((*it).second->playerBaseClass_==item->playerBaseClass_)
     36                return false;
    937        }
     38        return true;
     39        };
    1040}
Note: See TracChangeset for help on using the changeset viewer.