Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/bindermFS16/src/orxonox/LevelManager.h @ 11183

Last change on this file since 11183 was 11180, checked in by binderm, 9 years ago

logic to show only certain levels and not all together, also not all shown levels have to be activated

  • Property svn:eol-style set to native
File size: 5.5 KB
RevLine 
[2072]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 *      Fabian 'x3n' Landau
24 *   Co-authors:
[7802]25 *      Damian 'Mozork' Frick
[2072]26 *
27 */
28
[7804]29/**
30    @file LevelManager.h
31    @brief Definition of the LevelManager singleton.
32    @ingroup Orxonox
33*/
34
[2072]35#ifndef _LevelManager_H__
36#define _LevelManager_H__
37
38#include "OrxonoxPrereqs.h"
39
[3196]40#include <cassert>
[2072]41#include <list>
[7648]42#include <map>
[3304]43#include <string>
[3370]44
[7802]45#include "LevelInfo.h"
46
[3370]47#include "util/Singleton.h"
[9667]48#include "core/config/Configurable.h"
[2072]49
[11173]50
51namespace orxonox
52{
53
54    class LevelStatus
55    {
56    public:
57        LevelStatus();
58        virtual ~LevelStatus();
59       
60        bool won;
61        std::vector<int> nextLevels;
62
63    };
64}
65
[3280]66// tolua_begin
[2072]67namespace orxonox
68{
[7802]69
70    /**
71    @brief
[7803]72        The LevelManager keeps track of @ref orxonox::Level "Levels" whose activity has been requested and activates the @ref orxonox::Level "Levels" in the list in a FIFO manner with exactly one Level (the first in the list) being active at all times (unless the list is empty).
73        It also serves as an access point to get a list of all available @ref orxonox::Level "Levels" (or rather their respective @ref orxonox::LevelInfoItem "LevelInfoItems").
[7802]74
75    @author
76        Fabian 'x3n' Landau
77
78    @author
79        Damian 'Mozork' Frick
[7804]80
[11173]81
82    @ingroup Orxonox1
[7802]83    */
[11173]84
85
86
87
[2171]88    class _OrxonoxExport LevelManager
[3280]89    // tolua_end
[9667]90        : public Singleton<LevelManager>, public Configurable
[3280]91    { // tolua_export
[3370]92            friend class Singleton<LevelManager>;
[2072]93        public:
94            LevelManager();
95            virtual ~LevelManager();
96
[11180]97            void setLevelStatus(const int integer);
98            void buildallLevelStatus();
[11173]99
100
[7802]101            void setConfigValues(); //!< Set the config values for this object.
[3280]102
[7802]103            void requestActivity(Level* level); //!< Request activity for the input Level.
104            void releaseActivity(Level* level); //!< Release activity for the input Level.
[11173]105
[7802]106            Level* getActiveLevel(); //!< Get the currently active Level.
[2072]107
[7802]108            // tolua_begin
[11180]109            int missionactivate(int index);
[7802]110            void setDefaultLevel(const std::string& levelName); //!< Set the default Level.
111            /**
112            @brief Get the default level.
113            @return Returns the filename of the default level.
114            */
115            const std::string& getDefaultLevel() const
116                { return defaultLevelName_; }
117            unsigned int getNumberOfLevels(void);
118            LevelInfoItem* getAvailableLevelListItem(unsigned int index); //!< Get the LevelInfoItem at the given index in the list of available Levels.
[3280]119
[10258]120            void setLastFinishedCampaignMission(const std::string& lastFinishedCampaignMission);
121            inline const std::string& getLastFinishedCampaignMission() const
122                { return this->lastFinishedCampaignMission_; }
123
124            inline unsigned int getNumberOfCampaignMissions()
125                { return this->campaignMissions_.size(); }
[11173]126
[10258]127            inline const std::string& getCampaignMission(unsigned int index)
128                { return this->campaignMissions_[index]; }
129
[11173]130
[7802]131            /**
132            @brief Get the instance of the LevelManager.
133            @return Returns the instance of the LevelManager.
134            */
135            static LevelManager& getInstance()
136                { return Singleton<LevelManager>::getInstance(); }
137            // tolua_end
[2072]138
139        private:
[11071]140            // non-copyable:
141            LevelManager(const LevelManager&) = delete;
142            LevelManager& operator=(const LevelManager&) = delete;
[2072]143
[7802]144            void activateNextLevel(); //!< Activate the next level.
[2072]145
[7802]146            void compileAvailableLevelList(void); //!< Compile the list of available Levels.
147            void updateAvailableLevelList(void); //!< Update the list of available Levels.
[7648]148
[7802]149            std::list<Level*> levels_; //!< A list of all the Levels whose activity has been requested, in the order in which they will become active.
150            std::set<LevelInfoItem*, LevelInfoCompare> availableLevels_; //!< The set of available Levels sorted alphabetically according to the name of the Level.
[3196]151
[7802]152            // Helpers to allow fast access to the availableLevels list.
153            unsigned int nextIndex_; //! The next expected index to be accessed.
[8079]154            std::set<LevelInfoItem*, LevelInfoCompare>::iterator nextLevel_; //! The next expected Level to be accessed.
[7802]155
[3280]156            // config values
157            std::string defaultLevelName_;
[10258]158            std::string lastFinishedCampaignMission_;
159            std::vector<std::string> campaignMissions_;
[11180]160
[11173]161            std::vector<LevelStatus> allLevelStatus_;
[3280]162
[11173]163
164
[3370]165            static LevelManager* singletonPtr_s;
[3280]166    }; // tolua_export
167} // tolua_export
[2072]168
169#endif /* _LevelManager_H__ */
Note: See TracBrowser for help on using the repository browser.