Changeset 2293 for code/branches/pickups2/src/orxonox/objects/pickup
- Timestamp:
- Nov 28, 2008, 2:00:22 PM (16 years ago)
- Location:
- code/branches/pickups2/src/orxonox/objects/pickup
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickups2/src/orxonox/objects/pickup/Item.cc
r2289 r2293 1 1 /* has to be added to player 2 2 multimap<std::string, Item*> Equipment;*/ 3 3 4 4 5 #include "Item.h" … … 27 28 } 28 29 29 voidItem::addTo (Pawn* player)30 bool Item::addTo (Pawn* player) 30 31 { 31 if(checkSlot(player)==true)32 /*if(checkSlot(player)==true) 32 33 player->pickUp.Equipment.insert ( std::pair<std::string, Item*>(this->getName(),this) ); 33 34 else 34 COUT(3) << "swap?" << std::endl; 35 COUT(3) << "swap?" << std::endl;*/ 36 return player->getPickUp().insert(this); 35 37 } 36 38 bool Item::remove(Pawn* player) 37 39 { 38 if(player->pickUp.Equipment.find(this->getName())!= player->pickUp.Equipment.end())40 /*if(player->pickUp.Equipment.find(this->getName())!= player->pickUp.Equipment.end()) 39 41 { 40 42 std::multimap<std::string,Item*>::iterator it; … … 44 46 } 45 47 else 46 return false; 48 return false;*/ 49 return player->getPickUp().erase(this); 47 50 } 48 51 bool Item::checkSlot(Pawn* player) 49 52 { 50 std::multimap<std::string,Item*>::iterator it;53 /*std::multimap<std::string,Item*>::iterator it; 51 54 for ( it=player->pickUp.Equipment.begin() ; it != player->pickUp.Equipment.end(); it++ ) 52 55 { … … 54 57 return false; 55 58 } 56 return true; 59 return true;*/ 60 return player->getPickUp().checkSlot(this); 57 61 } 58 62 void Item::setPlayerBaseClassName(const std::string& name) -
code/branches/pickups2/src/orxonox/objects/pickup/Item.h
r2289 r2293 4 4 #include "core/BaseObject.h" 5 5 #include "OrxonoxPrereqs.h" 6 #include "ShipEquipment.h" 6 7 7 8 namespace orxonox … … 18 19 virtual bool dropped(Pawn* player) { return true; } //erst bei festen Items 19 20 bool remove(Pawn* player); 20 voidaddTo(Pawn* player);21 bool addTo(Pawn* player); 21 22 22 23 inline void setPlayerBaseClass(Identifier* identifier) -
code/branches/pickups2/src/orxonox/objects/pickup/ShipEquipment.cc
r2290 r2293 1 #include "Item.h" 1 2 2 #include "ShipEquipment.h"3 3 4 4 namespace orxonox 5 5 { 6 bool insert(Item* item)6 bool ShipEquipment::insert(Item* item) 7 7 { 8 8 if(checkSlot(player)==true) … … 11 11 COUT(3) << "swap?" << std::endl; 12 12 13 14 15 16 17 13 }; 18 bool erase (Item* item)14 bool ShipEquipment::erase (Item* item) 19 15 { 20 16 if(Equipment.find(item->getName())!= Equipment.end()) … … 28 24 return false; 29 25 }; 30 bool checkSlot(Item* item) const26 bool ShipEquipment::checkSlot(Item* item) const 31 27 { 32 28 std::multimap<std::string,Item*>::iterator it; -
code/branches/pickups2/src/orxonox/objects/pickup/ShipEquipment.h
r2290 r2293 29 29 bool insert(Item* item); 30 30 bool erase (Item* item); 31 bool checkSlot(Item* item) const;31 const bool checkSlot(Item* item) const; 32 32 // const std::multimap<std::string, Item*>& getEquipment() const { return this->Equipment; } 33 33
Note: See TracChangeset
for help on using the changeset viewer.