Last change
on this file since 2293 was
2293,
checked in by dsommer, 15 years ago
|
private umgangen aber er liesst irgendwie die libs nicht :S
|
File size:
767 bytes
|
Line | |
---|
1 | #include "Item.h" |
---|
2 | |
---|
3 | |
---|
4 | namespace orxonox |
---|
5 | { |
---|
6 | bool ShipEquipment::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 | bool ShipEquipment::erase (Item* item) |
---|
15 | { |
---|
16 | if(Equipment.find(item->getName())!= Equipment.end()) |
---|
17 | { |
---|
18 | std::multimap<std::string,Item*>::iterator it; |
---|
19 | it=Equipment.find(item->getName()); |
---|
20 | Equipment.erase (it); |
---|
21 | return true; |
---|
22 | } |
---|
23 | else |
---|
24 | return false; |
---|
25 | }; |
---|
26 | bool ShipEquipment::checkSlot(Item* item) const |
---|
27 | { |
---|
28 | std::multimap<std::string,Item*>::iterator it; |
---|
29 | for ( it=Equipment.begin() ; it != Equipment.end(); it++ ) |
---|
30 | { |
---|
31 | if((*it).second->playerBaseClass_==item->playerBaseClass_) |
---|
32 | return false; |
---|
33 | } |
---|
34 | return true; |
---|
35 | }; |
---|
36 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.