Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 25, 2010, 8:51:17 PM (13 years ago)
Author:
dafrick
Message:

Making the level list in the LevelManager (and as consequence the level list displayed by the GUI) alphabetically sorted. Also some cleanup and documented LevelManager.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/LevelManager.h

    r7648 r7802  
    2323 *      Fabian 'x3n' Landau
    2424 *   Co-authors:
    25  *      ...
     25 *      Damian 'Mozork' Frick
    2626 *
    2727 */
     
    3737#include <string>
    3838
     39#include "LevelInfo.h"
     40
    3941#include "util/Singleton.h"
    4042#include "core/OrxonoxClass.h"
     
    4345namespace orxonox
    4446{
     47
     48    /**
     49    @brief
     50        The LevelManager keeps track of @ref orxonox::Level "Levels" whose activity has been requested and serves as an access point to get a list of all available @ref orxonox::Level "Levels" (or rather their respective @ref orxonox::LevelInfoItem "LevelInfoItems").
     51
     52    @author
     53        Fabian 'x3n' Landau
     54
     55    @author
     56        Damian 'Mozork' Frick
     57    */
    4558    class _OrxonoxExport LevelManager
    4659    // tolua_end
     
    5265            virtual ~LevelManager();
    5366
    54             void setConfigValues();
     67            void setConfigValues(); //!< Set the config values for this object.
    5568
    56             void requestActivity(Level* level);
    57             void releaseActivity(Level* level);
    58             Level* getActiveLevel();
     69            void requestActivity(Level* level); //!< Request activity for the input Level.
     70            void releaseActivity(Level* level); //!< Release activity for the input Level.
     71            Level* getActiveLevel(); //!< Get the currently active Level.
    5972
    60             void setDefaultLevel(const std::string& levelName); //tolua_export
    61             const std::string& getDefaultLevel() const; //tolua_export
    62             unsigned int getNumberOfLevels(void); //tolua_export
    63             LevelInfoItem* getAvailableLevelListItem(unsigned int index) const; //tolua_export
     73            // tolua_begin
     74            void setDefaultLevel(const std::string& levelName); //!< Set the default Level.
     75            /**
     76            @brief Get the default level.
     77            @return Returns the filename of the default level.
     78            */
     79            const std::string& getDefaultLevel() const
     80                { return defaultLevelName_; }
     81            unsigned int getNumberOfLevels(void);
     82            LevelInfoItem* getAvailableLevelListItem(unsigned int index); //!< Get the LevelInfoItem at the given index in the list of available Levels.
    6483
    65             static LevelManager& getInstance()    { return Singleton<LevelManager>::getInstance(); } // tolua_export
     84            /**
     85            @brief Get the instance of the LevelManager.
     86            @return Returns the instance of the LevelManager.
     87            */
     88            static LevelManager& getInstance()
     89                { return Singleton<LevelManager>::getInstance(); }
     90            // tolua_end
    6691
    6792        private:
    6893            LevelManager(const LevelManager&);
    6994
    70             void activateNextLevel();
     95            void activateNextLevel(); //!< Activate the next level.
    7196
    72             void compileAvailableLevelList(void);
    73             void updateAvailableLevelList(void);
     97            void compileAvailableLevelList(void); //!< Compile the list of available Levels.
     98            void updateAvailableLevelList(void); //!< Update the list of available Levels.
    7499
    75             std::list<Level*> levels_s;
    76             std::vector<std::string> availableLevels_;
    77             std::map<std::string, LevelInfoItem*> infos_;
     100            std::list<Level*> levels_; //!< A list of all the Levels whose activity has been requested, in the order in which they will become active.
     101            std::set<LevelInfoItem*, LevelInfoCompare> availableLevels_; //!< The set of available Levels sorted alphabetically according to the name of the Level.
     102
     103            // Helpers to allow fast access to the availableLevels list.
     104            unsigned int nextIndex_; //! The next expected index to be accessed.
     105            std::set<LevelInfoItem*, LevelInfoCompare>::iterator nextLevel_; //! The nex expected Level to be accessed.
    78106
    79107            // config values
Note: See TracChangeset for help on using the changeset viewer.