[2917] | 1 | /* |
---|
| 2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
| 3 | * > www.orxonox.net < |
---|
| 4 | * |
---|
| 5 | * |
---|
| 6 | * License notice: |
---|
| 7 | * |
---|
| 8 | * This program is free software; you can redistribute it and/or |
---|
| 9 | * modify it under the terms of the GNU General Public License |
---|
| 10 | * as published by the Free Software Foundation; either version 2 |
---|
| 11 | * of the License, or (at your option) any later version. |
---|
| 12 | * |
---|
| 13 | * This program is distributed in the hope that it will be useful, |
---|
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 16 | * GNU General Public License for more details. |
---|
| 17 | * |
---|
| 18 | * You should have received a copy of the GNU General Public License |
---|
| 19 | * along with this program; if not, write to the Free Software |
---|
| 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
| 21 | * |
---|
| 22 | * Author: |
---|
| 23 | * Daniel 'Huty' Haggenmueller |
---|
| 24 | * Co-authors: |
---|
| 25 | * ... |
---|
| 26 | * |
---|
| 27 | */ |
---|
| 28 | |
---|
| 29 | /** |
---|
| 30 | @file |
---|
| 31 | @brief Definition of PickupCollection. |
---|
| 32 | */ |
---|
| 33 | |
---|
| 34 | #ifndef _PickupCollection_H__ |
---|
| 35 | #define _PickupCollection_H__ |
---|
| 36 | |
---|
| 37 | #include "OrxonoxPrereqs.h" |
---|
| 38 | |
---|
[3196] | 39 | #include <deque> |
---|
[2917] | 40 | #include <map> |
---|
| 41 | #include <string> |
---|
| 42 | |
---|
[3079] | 43 | #include "util/Math.h" |
---|
[2917] | 44 | #include "ModifierType.h" |
---|
| 45 | |
---|
| 46 | namespace orxonox |
---|
| 47 | { |
---|
| 48 | /** |
---|
[5947] | 49 | @brief PickupCollection for organising items. |
---|
| 50 | @author Daniel 'Huty' Haggenmueller |
---|
[2917] | 51 | */ |
---|
[6405] | 52 | class _OrxonoxExport PickupCollection : public orxonox::OrxonoxClass |
---|
[2917] | 53 | { |
---|
[5947] | 54 | public: |
---|
| 55 | PickupCollection(); |
---|
[2917] | 56 | |
---|
[5947] | 57 | bool add(BaseItem* item); //!< Add an item to the collection. |
---|
[2917] | 58 | |
---|
[5947] | 59 | bool checkSlot(BaseItem* item); //!< Check if there's a free slot in the collection for an item. |
---|
[2917] | 60 | |
---|
[5947] | 61 | void clear(); //!< Empty the collection |
---|
| 62 | bool contains(BaseItem* item, bool anyOfType = false); //!< Check if the collection contains an item. |
---|
[2917] | 63 | |
---|
[5947] | 64 | void remove(BaseItem* item, bool removeAllOfType = false); //!< Remove an item from the collection. |
---|
[2917] | 65 | |
---|
[6405] | 66 | //TODO: Hmm... probably should stay... |
---|
[5947] | 67 | void useItem(); //!< Use the first usable item. |
---|
| 68 | void useItem(UsableItem* item); //!< Use a usable item. |
---|
[2917] | 69 | |
---|
[5947] | 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; } |
---|
[2917] | 82 | |
---|
[5947] | 83 | inline UsableItem* getCurrentUsable() |
---|
| 84 | { return this->currentUsable_; }; |
---|
| 85 | inline void setCurrentUsable(UsableItem* usable) |
---|
| 86 | { this->currentUsable_ = usable; } |
---|
[3001] | 87 | |
---|
[5947] | 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. |
---|
[6405] | 91 | |
---|
[5947] | 92 | private: |
---|
[6405] | 93 | Pawn* owner_; //!< The owner of the PickupCollection. |
---|
[5947] | 94 | UsableItem* currentUsable_; |
---|
[6405] | 95 | int slots_; |
---|
[2917] | 96 | |
---|
[5947] | 97 | std::multimap<std::string, BaseItem*> items_; //!< Map of items in the collection (indexed by pickupIdentifier of the items). |
---|
[2917] | 98 | }; |
---|
| 99 | } |
---|
| 100 | |
---|
| 101 | #endif /* _PickupCollection_H__ */ |
---|