Changeset 2972 for code/branches/pickups2/src/orxonox/objects/pickup
- Timestamp:
- May 11, 2009, 6:03:40 PM (16 years ago)
- Location:
- code/branches/pickups2/src/orxonox/objects/pickup
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickups2/src/orxonox/objects/pickup/BaseItem.cc
r2917 r2972 35 35 36 36 #include "PickupCollection.h" 37 38 #include "core/CoreIncludes.h" 39 #include "core/XMLPort.h" 37 40 #include "objects/worldentities/pawns/Pawn.h" 38 41 … … 54 57 { 55 58 } 59 60 /** 61 @brief XMLPort for BaseItem. 62 @param xmlelement Element of the XML-file. 63 @param mode XMLPort mode to use. 64 */ 65 void BaseItem::XMLPort(Element& xmlelement, XMLPort::Mode mode) 66 { 67 SUPER(BaseItem, XMLPort, xmlelement, mode); 68 69 XMLPortParam(BaseItem, "guiText", setGUIText, getGUIText, xmlelement, mode); 70 XMLPortParam(BaseItem, "guiTooltip", setGUITooltip, getGUITooltip, xmlelement, mode); 71 XMLPortParam(BaseItem, "guiImage", setGUIImage, getGUIImage, xmlelement, mode); 72 } 73 56 74 /** 57 75 @brief Method to add the item to a pawn. -
code/branches/pickups2/src/orxonox/objects/pickup/BaseItem.h
r2917 r2972 39 39 #include "core/BaseObject.h" 40 40 41 // tolua_begin 41 42 namespace orxonox 42 43 { … … 51 52 class _OrxonoxExport BaseItem : public BaseObject 52 53 { 54 // tolua_end 53 55 public: 54 56 BaseItem(BaseObject* creator); 55 57 virtual ~BaseItem(); 58 59 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< XMLPort 56 60 57 61 /** … … 116 120 inline void setPickupIdentifier(const std::string& identifier) 117 121 { this->pickupIdentifier_ = identifier; } 122 123 // GUI stuff 124 virtual const std::string& getGUIText() 125 { return this->guiText_; } 126 inline void setGUIText(const std::string& text) 127 { this->guiText_ = text; } 128 129 virtual const std::string& getGUITooltip() 130 { return this->guiTooltip_; } 131 inline void setGUITooltip(const std::string& tooltip) 132 { this->guiTooltip_ = tooltip; } 133 134 virtual const std::string& getGUIImage() 135 { return this->guiImage_; } 136 inline void setGUIImage(const std::string& image) 137 { this->guiImage_ = image; } 118 138 private: 119 139 Pawn* owner_; //!< The current owner of the item. … … 127 147 */ 128 148 std::string pickupIdentifier_; 149 150 std::string guiText_; 151 std::string guiTooltip_; 152 std::string guiImage_; 129 153 }; 130 154 } -
code/branches/pickups2/src/orxonox/objects/pickup/CMakeLists.txt
r2917 r2972 7 7 PassiveItem.cc 8 8 PickupCollection.cc 9 PickupInventory.cc 9 10 PickupSpawner.cc 10 11 UsableItem.cc -
code/branches/pickups2/src/orxonox/objects/pickup/DroppedItem.cc
r2917 r2972 55 55 { 56 56 if (this->item_) 57 { 58 COUT(3) << "Delete DroppedItem with '" << this->item_->getPickupIdentifier() << "'" << std::endl; 57 59 delete this->item_; 60 } 58 61 59 62 delete this; -
code/branches/pickups2/src/orxonox/objects/pickup/PickupCollection.cc
r2917 r2972 38 38 #include "PassiveItem.h" 39 39 #include "UsableItem.h" 40 41 #include "core/CoreIncludes.h" 40 42 41 43 #include "objects/worldentities/pawns/Pawn.h" … … 312 314 @return Returns a list of all the equipment-type items in the collection. 313 315 */ 314 std:: set<BaseItem*> PickupCollection::getEquipmentItems()315 { 316 std:: set<BaseItem*> ret;316 std::deque<EquipmentItem*> PickupCollection::getEquipmentItems() 317 { 318 std::deque<EquipmentItem*> ret; 317 319 Identifier* ident = Class(EquipmentItem); 318 320 … … 320 322 { 321 323 if ((*it).second->isA(ident)) 322 ret. insert((*it).second);324 ret.push_back(dynamic_cast<EquipmentItem*>((*it).second)); 323 325 } 324 326 … … 329 331 @return Returns a list of all the passive items in the collection. 330 332 */ 331 std:: set<BaseItem*> PickupCollection::getPassiveItems()332 { 333 std:: set<BaseItem*> ret;333 std::deque<PassiveItem*> PickupCollection::getPassiveItems() 334 { 335 std::deque<PassiveItem*> ret; 334 336 Identifier* ident = Class(PassiveItem); 335 337 … … 337 339 { 338 340 if ((*it).second->isA(ident)) 339 ret. insert((*it).second);341 ret.push_back(dynamic_cast<PassiveItem*>((*it).second)); 340 342 } 341 343 … … 346 348 @return Returns a list of all the usable items in the collection. 347 349 */ 348 std:: set<BaseItem*> PickupCollection::getUsableItems()349 { 350 std:: set<BaseItem*> ret;350 std::deque<UsableItem*> PickupCollection::getUsableItems() 351 { 352 std::deque<UsableItem*> ret; 351 353 Identifier* ident = Class(UsableItem); 352 354 … … 354 356 { 355 357 if ((*it).second->isA(ident)) 356 ret. insert((*it).second);358 ret.push_back(dynamic_cast<UsableItem*>((*it).second)); 357 359 } 358 360 -
code/branches/pickups2/src/orxonox/objects/pickup/PickupCollection.h
r2917 r2972 38 38 39 39 #include <map> 40 #include < set>40 #include <deque> 41 41 #include <string> 42 42 … … 48 48 { 49 49 class BaseItem; 50 class EquipmentItem; 51 class PassiveItem; 50 52 class UsableItem; 51 53 class Pawn; … … 104 106 { this->owner_ = owner; } 105 107 106 std:: set<BaseItem*> getEquipmentItems(); //!< Get a list of equipment-type items.107 std:: set<BaseItem*> getPassiveItems(); //!< Get a list of passive items.108 std:: set<BaseItem*> getUsableItems(); //!< Get a list of usable items.108 std::deque<EquipmentItem*> getEquipmentItems(); //!< Get a list of equipment-type items. 109 std::deque<PassiveItem*> getPassiveItems(); //!< Get a list of passive items. 110 std::deque<UsableItem*> getUsableItems(); //!< Get a list of usable items. 109 111 private: 110 112 Pawn* owner_; //!< The owner of the PickupCollection. -
code/branches/pickups2/src/orxonox/objects/pickup/UsableItem.cc
r2917 r2972 26 26 * 27 27 */ 28 28 29 29 /** 30 30 @file
Note: See TracChangeset
for help on using the changeset viewer.