Line | |
---|
1 | |
---|
2 | #include "ShipEquipment.h" |
---|
3 | |
---|
4 | namespace orxonox |
---|
5 | { |
---|
6 | bool insert(Item* item) |
---|
7 | { |
---|
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; |
---|
37 | } |
---|
38 | return true; |
---|
39 | }; |
---|
40 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.