- Timestamp:
- Dec 25, 2009, 11:07:09 PM (14 years ago)
- Location:
- code/branches/pickup3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickup3
- Property svn:mergeinfo changed
/code/branches/pickup2 (added) merged: 5942,5947,5953,6405
- Property svn:mergeinfo changed
-
code/branches/pickup3/src/orxonox/pickup/PickupCollection.h
r5781 r6419 47 47 { 48 48 /** 49 50 49 @brief PickupCollection for organising items. 50 @author Daniel 'Huty' Haggenmueller 51 51 */ 52 class _OrxonoxExport PickupCollection 52 class _OrxonoxExport PickupCollection : public orxonox::OrxonoxClass 53 53 { 54 public:55 PickupCollection();54 public: 55 PickupCollection(); 56 56 57 bool add(BaseItem* item); //!< Add an item to the collection.57 bool add(BaseItem* item); //!< Add an item to the collection. 58 58 59 bool checkSlot(BaseItem* item); //!< Check if there's a free slot in the collection for an item.59 bool checkSlot(BaseItem* item); //!< Check if there's a free slot in the collection for an item. 60 60 61 void clear(); //!< Empty the collection62 bool contains(BaseItem* item, bool anyOfType = false); //!< Check if the collection contains an item.61 void clear(); //!< Empty the collection 62 bool contains(BaseItem* item, bool anyOfType = false); //!< Check if the collection contains an item. 63 63 64 void remove(BaseItem* item, bool removeAllOfType = false); //!< Remove an item from the collection.64 void remove(BaseItem* item, bool removeAllOfType = false); //!< Remove an item from the collection. 65 65 66 void useItem(); //!< Use the first usable item. 67 void useItem(UsableItem* item); //!< Use a usable item. 66 //TODO: Hmm... probably should stay... 67 void useItem(); //!< Use the first usable item. 68 void useItem(UsableItem* item); //!< Use a usable item. 68 69 69 void addAdditiveModifier(ModifierType::Value type, float value); //!< Add an additive modifier. 70 void addMultiplicativeModifier(ModifierType::Value type, float value); //!< Add a multiplicative modifier. 70 /** 71 @brief Get the owner of the PickupCollection. 72 @return Returns the pawn which owns the PickupCollection. 73 */ 74 inline Pawn* getOwner() const 75 { return this->owner_; } 76 /** 77 @brief Set the owner of the PickupCollection. 78 @param owner The new Pawn which owns the PickupCollection. 79 */ 80 inline void setOwner(Pawn* owner) 81 { this->owner_ = owner; } 71 82 72 float getAdditiveModifier(ModifierType::Value type); //!< Get total additive modifier. 73 float getMultiplicativeModifier(ModifierType::Value type); //!< Get total multiplicative modifier. 83 inline UsableItem* getCurrentUsable() 84 { return this->currentUsable_; }; 85 inline void setCurrentUsable(UsableItem* usable) 86 { this->currentUsable_ = usable; } 74 87 75 void removeAdditiveModifier(ModifierType::Value type, float value); //!< Remove an additive modifier. 76 void removeMultiplicativeModifier(ModifierType::Value type, float value); //!< Remove a multiplicative modifier. 88 std::deque<EquipmentItem*> getEquipmentItems(); //!< Get a list of equipment-type items. 89 std::deque<PassiveItem*> getPassiveItems(); //!< Get a list of passive items. 90 std::deque<UsableItem*> getUsableItems(); //!< Get a list of usable items. 77 91 78 float processModifiers(ModifierType::Value type, float inputValue, bool addBeforeMultiplication = false); //!< Apply the modifiers to a float. 79 Vector3 processModifiers(ModifierType::Value type, Vector3 inputValue, bool addBeforeMultiplication = false); //!< Apply the modifiers to a Vector3. 92 private: 93 Pawn* owner_; //!< The owner of the PickupCollection. 94 UsableItem* currentUsable_; 95 int slots_; 80 96 81 /** 82 @brief Get the map of contained items. 83 @return The map of items. 84 */ 85 std::multimap<std::string, BaseItem*> getItems() const 86 { return this->items_; } 87 88 /** 89 @brief Get the owner of the PickupCollection. 90 @return Returns the pawn which owns the PickupCollection. 91 */ 92 inline Pawn* getOwner() const 93 { return this->owner_; } 94 /** 95 @brief Set the owner of the PickupCollection. 96 @param owner The new Pawn which owns the PickupCollection. 97 */ 98 inline void setOwner(Pawn* owner) 99 { this->owner_ = owner; } 100 101 inline UsableItem* getCurrentUsable() 102 { return this->currentUsable_; }; 103 inline void setCurrentUsable(UsableItem* usable) 104 { this->currentUsable_ = usable; } 105 106 std::deque<EquipmentItem*> getEquipmentItems(); //!< Get a list of equipment-type items. 107 std::deque<PassiveItem*> getPassiveItems(); //!< Get a list of passive items. 108 std::deque<UsableItem*> getUsableItems(); //!< Get a list of usable items. 109 private: 110 Pawn* owner_; //!< The owner of the PickupCollection. 111 UsableItem* currentUsable_; 112 113 bool bBlockRemovals_; //!< Whether to block direct removals through remove(). 114 115 std::multimap<ModifierType::Value, float> additiveModifiers_; //!< Contains additive modifiers (indexed by ModifierType). 116 std::multimap<ModifierType::Value, float> multiplicativeModifiers_; //!< Contains multiplicative modifiers (indexed by ModifierType). 117 118 std::multimap<std::string, BaseItem*> items_; //!< Map of items in the collection (indexed by pickupIdentifier of the items). 97 std::multimap<std::string, BaseItem*> items_; //!< Map of items in the collection (indexed by pickupIdentifier of the items). 119 98 }; 120 99 }
Note: See TracChangeset
for help on using the changeset viewer.