Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/orxonox/objects/pickup/PickupCollection.h @ 5397

Last change on this file since 5397 was 3280, checked in by rgrieder, 15 years ago

Merged most of the core4 revisions back to the trunk except for:

  • orxonox_cast
  • all the radical changes in the input library
  • Property svn:eol-style set to native
File size: 4.9 KB
RevLine 
[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
46namespace orxonox
47{
48    /**
49        @brief PickupCollection for organising items.
50        @author Daniel 'Huty' Haggenmueller
51    */
52    class _OrxonoxExport PickupCollection
53    {
54    public:
55        PickupCollection();
56
57        bool add(BaseItem* item);       //!< Add an item to the collection.
58
59        bool checkSlot(BaseItem* item); //!< Check if there's a free slot in the collection for an item.
60
61        void clear();                   //!< Empty the collection
62        bool contains(BaseItem* item, bool anyOfType = false);                      //!< Check if the collection contains an item.
63
64        void remove(BaseItem* item, bool removeAllOfType = false);                  //!< Remove an item from the collection.
65
66        void useItem();                                                             //!< Use the first usable item.
67        void useItem(UsableItem* item);                                             //!< Use a usable item.
68
[3280]69        void addAdditiveModifier(ModifierType::Value type, float value);             //!< Add an additive modifier.
70        void addMultiplicativeModifier(ModifierType::Value type, float value);       //!< Add a multiplicative modifier.
[2917]71
[3280]72        float getAdditiveModifier(ModifierType::Value type);                         //!< Get total additive modifier.
73        float getMultiplicativeModifier(ModifierType::Value type);                   //!< Get total multiplicative modifier.
[2917]74
[3280]75        void removeAdditiveModifier(ModifierType::Value type, float value);          //!< Remove an additive modifier.
76        void removeMultiplicativeModifier(ModifierType::Value type, float value);    //!< Remove a multiplicative modifier.
[2917]77
[3280]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.
[2917]80
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        */
[3079]92        inline Pawn* getOwner() const
[2917]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
[3001]101        inline UsableItem* getCurrentUsable()
102            { return this->currentUsable_; };
103        inline void setCurrentUsable(UsableItem* usable)
104            { this->currentUsable_ = usable; }
105
[2972]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.
[2917]109    private:
110        Pawn* owner_;           //!< The owner of the PickupCollection.
[3001]111        UsableItem* currentUsable_;
[2917]112
113        bool bBlockRemovals_;   //!< Whether to block direct removals through remove().
114
[3280]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).
[2917]117
118        std::multimap<std::string, BaseItem*> items_;                       //!< Map of items in the collection (indexed by pickupIdentifier of the items).
119    };
120}
121
122#endif /* _PickupCollection_H__ */
Note: See TracBrowser for help on using the repository browser.