Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/pickups2/src/orxonox/objects/pickup/ShipEquipment.cc @ 2294

Last change on this file since 2294 was 2294, checked in by dsommer, 15 years ago


File size: 794 bytes
Line 
1#include "Item.h"
2#include "ShipEquipment.h"
3
4
5namespace orxonox
6{
7        bool ShipEquipment::insert(Item* item)
8        {
9        if(checkSlot(player)==true)
10                Equipment.insert ( std::pair<std::string, Item*>(item->getName(),item) );
11        else
12                COUT(3) << "swap?" << std::endl;
13       
14        };
15        bool ShipEquipment::erase (Item* item)
16        {
17        if(Equipment.find(item->getName())!= Equipment.end())
18        {
19                std::multimap<std::string,Item*>::iterator it;
20                it=Equipment.find(item->getName());
21                Equipment.erase (it);
22                return true;
23        }
24        else
25                return false;
26        };
27        bool ShipEquipment::checkSlot(Item* item) const
28        {
29        std::multimap<std::string,Item*>::iterator it;
30        for ( it=Equipment.begin() ; it != Equipment.end(); it++ )
31        {
32                if((*it).second->playerBaseClass_==item->playerBaseClass_)
33                return false;
34        }
35        return true;
36        };
37}
Note: See TracBrowser for help on using the repository browser.