Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 29, 2009, 1:32:40 PM (16 years ago)
Author:
rgrieder
Message:

Moved Game::getLevel to LevelManager::getStartLevel and Game::setLevel to LevelManager::setStartLevel.

Location:
code/branches/core4/src/orxonox
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core4/src/orxonox/CMakeLists.txt

    r3204 r3245  
    4242  FIND_HEADER_FILES
    4343  TOLUA_FILES
     44    LevelManager.h
    4445    gui/GUIManager.h
    4546    objects/pickup/BaseItem.h
  • code/branches/core4/src/orxonox/LevelManager.cc

    r3196 r3245  
    3030
    3131#include <map>
     32
     33#include "core/CommandLine.h"
     34#include "core/ConfigValueIncludes.h"
     35#include "core/CoreIncludes.h"
    3236#include "PlayerManager.h"
    3337#include "objects/Level.h"
     
    4246        assert(singletonRef_s == 0);
    4347        singletonRef_s = this;
     48
     49        RegisterRootObject(LevelManager);
     50        this->setConfigValues();
     51
     52        // check override
     53        if (!CommandLine::getArgument("level")->hasDefaultValue())
     54        {
     55            ModifyConfigValue(startLevelName_, tset, CommandLine::getValue("mediaPath").getString());
     56        }
    4457    }
    4558
     
    4861        assert(singletonRef_s != 0);
    4962        singletonRef_s = 0;
     63    }
     64
     65    void LevelManager::setConfigValues()
     66    {
     67        SetConfigValue(startLevelName_, "presentation_dm.oxw")
     68            .description("Sets the preselection of the level in the main menu.");
    5069    }
    5170
     
    93112        }
    94113    }
     114
     115    void LevelManager::setStartLevel(const std::string& levelName)
     116    {
     117        ModifyConfigValue(startLevelName_, set, levelName);
     118    }
     119
     120    const std::string& LevelManager::getStartLevel()
     121    {
     122        return startLevelName_;
     123    }
    95124}
  • code/branches/core4/src/orxonox/LevelManager.h

    r3196 r3245  
    3434#include <cassert>
    3535#include <list>
     36#include "core/OrxonoxClass.h"
    3637
     38// tolua_begin
    3739namespace orxonox
    3840{
    3941    class _OrxonoxExport LevelManager
    40     {
     42    // tolua_end
     43        : public OrxonoxClass
     44    { // tolua_export
    4145        public:
    4246            LevelManager();
    4347            virtual ~LevelManager();
     48
     49            void setConfigValues();
    4450
    4551            void requestActivity(Level* level);
     
    4753            Level* getActiveLevel();
    4854
     55            void setStartLevel(const std::string& levelName); //tolua_export
     56            const std::string& getStartLevel(); //tolua_export
     57
    4958            static LevelManager* getInstancePtr() { return singletonRef_s; }
    50             static LevelManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; }
     59            static LevelManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; } // tolua_export
    5160
    5261        private:
     
    5766            std::list<Level*> levels_s;
    5867
     68            // config values
     69            std::string startLevelName_;
     70
    5971            static LevelManager* singletonRef_s;
    60     };
    61 }
     72    }; // tolua_export
     73} // tolua_export
    6274
    6375#endif /* _LevelManager_H__ */
  • code/branches/core4/src/orxonox/gamestates/GSLevel.cc

    r3243 r3245  
    7171        , radar_(0)
    7272        , cameraManager_(0)
    73         , levelManager_(0)
    7473    {
    7574        RegisterObject(GSLevel);
     
    120119        if (GameMode::isMaster())
    121120        {
    122             // create the global LevelManager
    123             this->levelManager_ = new LevelManager();
    124 
    125121            this->loadLevel();
    126122        }
     
    202198        }
    203199
    204         if (this->levelManager_)
    205         {
    206             delete this->levelManager_;
    207             this->levelManager_ = 0;
    208         }
    209 
    210200        if (this->playerManager_)
    211201        {
     
    255245        CommandLine::getValue("level", &levelName);
    256246        if (levelName == "")
    257             startFile_s = new XMLFile(Core::getMediaPathString() + "levels" + '/' + Game::getInstance().getLevel());
     247            startFile_s = new XMLFile(Core::getMediaPathString() + "levels" + '/' + LevelManager::getInstance().getStartLevel());
    258248        else
    259249            startFile_s = new XMLFile(Core::getMediaPathString() + "levels" + '/' + levelName);
  • code/branches/core4/src/orxonox/gamestates/GSLevel.h

    r3243 r3245  
    6868        Radar*                radar_;                   //!< represents the Radar (not the HUD part)
    6969        CameraManager*        cameraManager_;           //!< camera manager for this level
    70         LevelManager*         levelManager_;            //!< global level manager
    7170        PlayerManager*        playerManager_;           //!< player manager for this level
    7271        QuestManager*         questManager_;
  • code/branches/core4/src/orxonox/gamestates/GSMainMenu.cc

    r3243 r3245  
    6767
    6868        // show main menu
    69         GUIManager::getInstance().showGUI("mainmenu_2");
     69        GUIManager::getInstance().showGUI("mainmenu_3");
    7070        GUIManager::getInstance().setCamera(this->camera_);
    7171        GraphicsManager::getInstance().setCamera(this->camera_);
  • code/branches/core4/src/orxonox/gamestates/GSRoot.cc

    r3243 r3245  
    3737#include "interfaces/TimeFactorListener.h"
    3838#include "interfaces/Tickable.h"
     39#include "LevelManager.h"
    3940
    4041namespace orxonox
     
    8384        }
    8485
     86        // create the global LevelManager
     87        this->levelManager_ = new LevelManager();
     88
    8589        // Load level directly?
    8690        bool loadLevel = false;
     
    129133        }
    130134*/
     135
     136        delete this->levelManager_;
    131137    }
    132138
  • code/branches/core4/src/orxonox/gamestates/GSRoot.h

    r3243 r3245  
    5252
    5353    private:
    54         float                 timeFactor_;       //!< A factor that sets the gamespeed. 1 is normal.
     54        float                 timeFactor_;              //!< A factor that sets the gamespeed. 1 is normal.
    5555        bool                  bPaused_;
    5656        float                 timeFactorPauseBackup_;
     57
     58        LevelManager*         levelManager_;            //!< global level manager
    5759
    5860        // console commands
Note: See TracChangeset for help on using the changeset viewer.