Changeset 3245 for code/branches
- Timestamp:
- Jun 29, 2009, 1:32:40 PM (15 years ago)
- Location:
- code/branches/core4/src
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core4/src/core/CMakeLists.txt
r3196 r3245 68 68 TOLUA_FILES 69 69 CommandExecutor.h 70 Game.h71 70 LuaBind.h 72 71 DEFINE_SYMBOL -
code/branches/core4/src/core/Game.cc
r3243 r3245 149 149 SetConfigValue(statisticsAvgLength_, 1000000) 150 150 .description("Sets the time in microseconds interval at which average fps, etc. gets calculated."); 151 SetConfigValue(levelName_, "presentation_dm.oxw")152 .description("Sets the preselection of the level in the main menu.");153 }154 155 void Game::setLevel(std::string levelName)156 {157 ModifyConfigValue(levelName_, set, levelName);158 }159 160 std::string Game::getLevel()161 {162 std::string levelName;163 CommandLine::getValue("level", &levelName);164 if (levelName == "")165 return levelName_;166 else167 return levelName;168 151 } 169 152 -
code/branches/core4/src/core/Game.h
r3243 r3245 64 64 Main class responsible for running the game. 65 65 */ 66 class _CoreExport Game 67 // tolua_end 68 : public OrxonoxClass 69 // tolua_begin 66 class _CoreExport Game : public OrxonoxClass 70 67 { 71 //tolua_end72 68 public: 73 69 Game(int argc, char** argv); … … 94 90 template <class T> 95 91 static bool declareGameState(const std::string& className, const std::string& stateName, bool bIgnoreTickTime, bool bConsoleMode); 96 static Game& getInstance() { assert(singletonRef_s); return *singletonRef_s; } //tolua_export 97 98 void setLevel(std::string levelName); //tolua_export 99 std::string getLevel(); //tolua_export 92 static Game& getInstance() { assert(singletonRef_s); return *singletonRef_s; } 100 93 101 94 private: … … 163 156 unsigned int statisticsRefreshCycle_; 164 157 unsigned int statisticsAvgLength_; 165 std::string levelName_;166 158 167 159 static std::map<std::string, GameStateInfo> gameStateDeclarations_s; 168 160 static Game* singletonRef_s; //!< Pointer to the Singleton 169 }; // tolua_export161 }; 170 162 171 163 template <class T> … … 193 185 return true; 194 186 } 195 } // tolua_export187 } 196 188 197 189 #endif /* _Game_H__ */ -
code/branches/core4/src/orxonox/CMakeLists.txt
r3204 r3245 42 42 FIND_HEADER_FILES 43 43 TOLUA_FILES 44 LevelManager.h 44 45 gui/GUIManager.h 45 46 objects/pickup/BaseItem.h -
code/branches/core4/src/orxonox/LevelManager.cc
r3196 r3245 30 30 31 31 #include <map> 32 33 #include "core/CommandLine.h" 34 #include "core/ConfigValueIncludes.h" 35 #include "core/CoreIncludes.h" 32 36 #include "PlayerManager.h" 33 37 #include "objects/Level.h" … … 42 46 assert(singletonRef_s == 0); 43 47 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 } 44 57 } 45 58 … … 48 61 assert(singletonRef_s != 0); 49 62 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."); 50 69 } 51 70 … … 93 112 } 94 113 } 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 } 95 124 } -
code/branches/core4/src/orxonox/LevelManager.h
r3196 r3245 34 34 #include <cassert> 35 35 #include <list> 36 #include "core/OrxonoxClass.h" 36 37 38 // tolua_begin 37 39 namespace orxonox 38 40 { 39 41 class _OrxonoxExport LevelManager 40 { 42 // tolua_end 43 : public OrxonoxClass 44 { // tolua_export 41 45 public: 42 46 LevelManager(); 43 47 virtual ~LevelManager(); 48 49 void setConfigValues(); 44 50 45 51 void requestActivity(Level* level); … … 47 53 Level* getActiveLevel(); 48 54 55 void setStartLevel(const std::string& levelName); //tolua_export 56 const std::string& getStartLevel(); //tolua_export 57 49 58 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 51 60 52 61 private: … … 57 66 std::list<Level*> levels_s; 58 67 68 // config values 69 std::string startLevelName_; 70 59 71 static LevelManager* singletonRef_s; 60 }; 61 } 72 }; // tolua_export 73 } // tolua_export 62 74 63 75 #endif /* _LevelManager_H__ */ -
code/branches/core4/src/orxonox/gamestates/GSLevel.cc
r3243 r3245 71 71 , radar_(0) 72 72 , cameraManager_(0) 73 , levelManager_(0)74 73 { 75 74 RegisterObject(GSLevel); … … 120 119 if (GameMode::isMaster()) 121 120 { 122 // create the global LevelManager123 this->levelManager_ = new LevelManager();124 125 121 this->loadLevel(); 126 122 } … … 202 198 } 203 199 204 if (this->levelManager_)205 {206 delete this->levelManager_;207 this->levelManager_ = 0;208 }209 210 200 if (this->playerManager_) 211 201 { … … 255 245 CommandLine::getValue("level", &levelName); 256 246 if (levelName == "") 257 startFile_s = new XMLFile(Core::getMediaPathString() + "levels" + '/' + Game::getInstance().getLevel());247 startFile_s = new XMLFile(Core::getMediaPathString() + "levels" + '/' + LevelManager::getInstance().getStartLevel()); 258 248 else 259 249 startFile_s = new XMLFile(Core::getMediaPathString() + "levels" + '/' + levelName); -
code/branches/core4/src/orxonox/gamestates/GSLevel.h
r3243 r3245 68 68 Radar* radar_; //!< represents the Radar (not the HUD part) 69 69 CameraManager* cameraManager_; //!< camera manager for this level 70 LevelManager* levelManager_; //!< global level manager71 70 PlayerManager* playerManager_; //!< player manager for this level 72 71 QuestManager* questManager_; -
code/branches/core4/src/orxonox/gamestates/GSMainMenu.cc
r3243 r3245 67 67 68 68 // show main menu 69 GUIManager::getInstance().showGUI("mainmenu_ 2");69 GUIManager::getInstance().showGUI("mainmenu_3"); 70 70 GUIManager::getInstance().setCamera(this->camera_); 71 71 GraphicsManager::getInstance().setCamera(this->camera_); -
code/branches/core4/src/orxonox/gamestates/GSRoot.cc
r3243 r3245 37 37 #include "interfaces/TimeFactorListener.h" 38 38 #include "interfaces/Tickable.h" 39 #include "LevelManager.h" 39 40 40 41 namespace orxonox … … 83 84 } 84 85 86 // create the global LevelManager 87 this->levelManager_ = new LevelManager(); 88 85 89 // Load level directly? 86 90 bool loadLevel = false; … … 129 133 } 130 134 */ 135 136 delete this->levelManager_; 131 137 } 132 138 -
code/branches/core4/src/orxonox/gamestates/GSRoot.h
r3243 r3245 52 52 53 53 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. 55 55 bool bPaused_; 56 56 float timeFactorPauseBackup_; 57 58 LevelManager* levelManager_; //!< global level manager 57 59 58 60 // console commands
Note: See TracChangeset
for help on using the changeset viewer.