Changeset 3370 for code/trunk/src/orxonox/gamestates/GSRoot.cc
- Timestamp:
- Jul 30, 2009, 2:10:44 PM (15 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/resource (added) merged: 3328,3336-3340,3342-3350,3352-3366
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/gamestates/GSRoot.cc
r3304 r3370 30 30 31 31 #include "core/Clock.h" 32 #include "core/CommandLine.h"33 32 #include "core/ConsoleCommand.h" 34 33 #include "core/Game.h" 35 34 #include "core/GameMode.h" 35 #include "core/LuaBind.h" 36 36 #include "network/NetworkFunction.h" 37 #include "ToluaBindCore.h" 38 #include "ToluaBindOrxonox.h" 37 39 #include "tools/Timer.h" 38 40 #include "interfaces/TimeFactorListener.h" … … 42 44 namespace orxonox 43 45 { 44 DeclareGameState(GSRoot, "root", true, false); 45 SetCommandLineSwitch(console).information("Start in console mode (text IO only)"); 46 // Shortcuts for easy direct loading 47 SetCommandLineSwitch(server).information("Start in server mode"); 48 SetCommandLineSwitch(client).information("Start in client mode"); 49 SetCommandLineSwitch(dedicated).information("Start in dedicated server mode"); 50 SetCommandLineSwitch(standalone).information("Start in standalone mode"); 46 DeclareGameState(GSRoot, "root", false, false); 51 47 52 GSRoot::GSRoot(const GameState ConstrParams& params)53 : GameState( params)48 GSRoot::GSRoot(const GameStateInfo& info) 49 : GameState(info) 54 50 , timeFactor_(1.0f) 55 51 , bPaused_(false) … … 58 54 this->ccSetTimeFactor_ = 0; 59 55 this->ccPause_ = 0; 56 57 // Tell LuaBind about all tolua interfaces 58 LuaBind::getInstance().addToluaInterface(&tolua_Core_open, "Core"); 59 LuaBind::getInstance().addToluaInterface(&tolua_Orxonox_open, "Orxonox"); 60 60 } 61 61 … … 88 88 // create the global LevelManager 89 89 this->levelManager_ = new LevelManager(); 90 91 // Load level directly?92 bool loadLevel = false;93 if (CommandLine::getValue("standalone").getBool())94 {95 Game::getInstance().requestStates("graphics, standalone, level");96 loadLevel = true;97 }98 if (CommandLine::getValue("server").getBool())99 {100 Game::getInstance().requestStates("graphics, server, level");101 loadLevel = true;102 }103 if (CommandLine::getValue("client").getBool())104 {105 Game::getInstance().requestStates("graphics, client, level");106 loadLevel = true;107 }108 if (CommandLine::getValue("dedicated").getBool())109 {110 Game::getInstance().requestStates("dedicated, level");111 loadLevel = true;112 }113 114 // Determine where to start otherwise115 if (!loadLevel && !CommandLine::getValue("console").getBool())116 {117 // Also load graphics118 Game::getInstance().requestState("graphics");119 }120 90 } 121 91 … … 148 118 } 149 119 150 uint64_t timeBeforeTick = time.getRealMicroseconds();151 152 120 for (ObjectList<TimerBase>::iterator it = ObjectList<TimerBase>::begin(); it; ++it) 153 121 it->tick(time); … … 164 132 it->tick(leveldt * this->timeFactor_); 165 133 /*** HACK *** HACK ***/ 166 167 uint64_t timeAfterTick = time.getRealMicroseconds();168 169 // Also add our tick time170 Game::getInstance().addTickTime(timeAfterTick - timeBeforeTick);171 134 } 172 135 … … 174 137 @brief 175 138 Changes the speed of Orxonox 139 @remark 140 This function is a hack when placed here! 141 Timefactor should be related to the scene (level or so), not the game 176 142 */ 177 143 void GSRoot::setTimeFactor(float factor)
Note: See TracChangeset
for help on using the changeset viewer.