Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/presentation3/src/modules/pickup/PickupManager.h @ 7086

Last change on this file since 7086 was 6996, checked in by dafrick, 14 years ago

Loads of changes.
1) PickupInventory should now be working even for extreme cases.
2) Added support for inactive Spawnpoints in Gametype.
3) Made Pickupable rewardble. meaning from now on any Pickupable can be given as a reward for completing Quests.
4) Added some keybinds to KeybindMenu, such as PickupInventory, QuestGUI and Chat.

File size: 4.2 KB
RevLine 
[6474]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 *      Damian 'Mozork' Frick
24 *   Co-authors:
25 *      ...
26 *
27*/
28
29/**
[6540]30    @file PickupManager.h
[6474]31    @brief Definition of the PickupManager class.
32*/
33
34#ifndef _PickupManager_H__
35#define _PickupManager_H__
36
37#include "PickupPrereqs.h"
38
39#include <map>
40#include "util/Singleton.h"
[6996]41#include "core/WeakPtr.h"
[6474]42#include "pickup/PickupIdentifier.h"
43#include "PickupRepresentation.h"
44
45#include "core/OrxonoxClass.h"
46
[6711]47namespace orxonox // tolua_export
48{ // tolua_export
[6474]49
50    /**
51    @brief
52        Manages Pickupables.
[6711]53        In essence has two tasks to fulfill. Firstly it must link Pickupables (through their PickupIdentifiers) and their PickupRepresentations. Secondly it manages the PickupInventory.
[6474]54        //TODO: Manage Pickup GUI.
55    @author
56        Damian 'Mozork' Frick
57    */
[6711]58    class _PickupExport PickupManager // tolua_export
59        : public Singleton<PickupManager>, public OrxonoxClass
60    { // tolua_export
[6474]61        friend class Singleton<PickupManager>;
62       
63        public:
64            PickupManager();
65            virtual ~PickupManager();
66           
[6711]67            static PickupManager& getInstance() { return Singleton<PickupManager>::getInstance(); } // tolua_export
[6474]68           
[6475]69            bool registerRepresentation(const PickupIdentifier* identifier, PickupRepresentation* representation); //!< Registers a PickupRepresentation together with the PickupIdentifier of the Pickupable the PickupRepresentation represents.
[6725]70            bool unregisterRepresentation(const PickupIdentifier* identifier, PickupRepresentation* representation); //!< Unegisters a PickupRepresentation together with the PickupIdentifier of the Pickupable the PickupRepresentation represents.
[6474]71            PickupRepresentation* getRepresentation(const PickupIdentifier* identifier); //!< Get the PickupRepresentation representing the Pickupable with the input PickupIdentifier.
72           
[6711]73            // tolua_begin
[6965]74            int getNumPickups(void);
[6996]75            orxonox::Pickupable* popPickup(void) { return (this->pickupsIterator_++)->first; }
[6965]76            orxonox::PickupRepresentation* getPickupRepresentation(orxonox::Pickupable* pickup) { if(pickup != NULL) return this->getRepresentation(pickup->getPickupIdentifier()); return NULL; }
77
78            void dropPickup(orxonox::Pickupable* pickup);
79            void usePickup(orxonox::Pickupable* pickup, bool use);
[6996]80            bool isValidPickup(orxonox::Pickupable* pickup) { std::map<Pickupable*, WeakPtr<Pickupable> >::iterator it = this->pickupsList_.find(pickup); if(it == this->pickupsList_.end()) return false; return it->second.get() != NULL; }
[6711]81            // tolua_end
82           
[6474]83        private:
84            static PickupManager* singletonPtr_s;
[6711]85            static const std::string guiName_s;
[6474]86           
87            PickupRepresentation* defaultRepresentation_; //!< The default PickupRepresentation.
[6475]88            std::map<const PickupIdentifier*, PickupRepresentation*, PickupIdentifierCompare> representations_; //!< Map linking PickupIdentifiers (representing types if Pickupables) and PickupRepresentations.
[6965]89
[6996]90            std::map<Pickupable*, WeakPtr<Pickupable> > pickupsList_;
91            std::map<Pickupable*, WeakPtr<Pickupable> >::iterator pickupsIterator_;
[6965]92
93            std::vector<PickupCarrier*>* getAllCarriers(PickupCarrier* carrier);
[6474]94       
[6711]95    }; // tolua_export
[6474]96   
[6711]97} // tolua_export
[6474]98
99#endif // _PickupManager_H__
Note: See TracBrowser for help on using the repository browser.