[Orxonox-commit 711] r3243 - in branches/core4/src: core orxonox orxonox/gamestates
rgrieder at orxonox.net
rgrieder at orxonox.net
Sun Jun 28 18:22:41 CEST 2009
Author: rgrieder
Date: 2009-06-28 18:22:40 +0200 (Sun, 28 Jun 2009)
New Revision: 3243
Modified:
branches/core4/src/core/CorePrereqs.h
branches/core4/src/core/Game.cc
branches/core4/src/core/Game.h
branches/core4/src/core/GameState.cc
branches/core4/src/core/GameState.h
branches/core4/src/orxonox/Main.cc
branches/core4/src/orxonox/gamestates/GSClient.cc
branches/core4/src/orxonox/gamestates/GSClient.h
branches/core4/src/orxonox/gamestates/GSDedicated.cc
branches/core4/src/orxonox/gamestates/GSDedicated.h
branches/core4/src/orxonox/gamestates/GSGraphics.cc
branches/core4/src/orxonox/gamestates/GSGraphics.h
branches/core4/src/orxonox/gamestates/GSIOConsole.cc
branches/core4/src/orxonox/gamestates/GSIOConsole.h
branches/core4/src/orxonox/gamestates/GSLevel.cc
branches/core4/src/orxonox/gamestates/GSLevel.h
branches/core4/src/orxonox/gamestates/GSMainMenu.cc
branches/core4/src/orxonox/gamestates/GSMainMenu.h
branches/core4/src/orxonox/gamestates/GSRoot.cc
branches/core4/src/orxonox/gamestates/GSRoot.h
branches/core4/src/orxonox/gamestates/GSServer.cc
branches/core4/src/orxonox/gamestates/GSServer.h
branches/core4/src/orxonox/gamestates/GSStandalone.cc
branches/core4/src/orxonox/gamestates/GSStandalone.h
Log:
Moved GameState construction from pre-main() to after Core creation. That makes it possible to use Core features (like configValues) in the GameState constructor.
Modified: branches/core4/src/core/CorePrereqs.h
===================================================================
--- branches/core4/src/core/CorePrereqs.h 2009-06-28 15:35:50 UTC (rev 3242)
+++ branches/core4/src/core/CorePrereqs.h 2009-06-28 16:22:40 UTC (rev 3243)
@@ -164,6 +164,7 @@
// game states
class Game;
+ struct GameStateConstrParams;
class GameState;
struct GameStateTreeNode;
Modified: branches/core4/src/core/Game.cc
===================================================================
--- branches/core4/src/core/Game.cc 2009-06-28 15:35:50 UTC (rev 3242)
+++ branches/core4/src/core/Game.cc 2009-06-28 16:22:40 UTC (rev 3243)
@@ -53,14 +53,9 @@
using boost::shared_ptr;
using boost::weak_ptr;
- std::map<std::string, GameState*> Game::allStates_s;
- Game* Game::singletonRef_s = 0;
-
static void stop_game()
{ Game::getInstance().stop(); }
SetConsoleCommandShortcutExternAlias(stop_game, "exit");
- // Add an empty gamestate that serves as internal root state
- AddGameState(GameState, "emptyRootGameState");
struct _CoreExport GameStateTreeNode
{
@@ -69,23 +64,28 @@
std::vector<shared_ptr<GameStateTreeNode> > children_;
};
+ std::map<std::string, Game::GameStateInfo> Game::gameStateDeclarations_s;
+ Game* Game::singletonRef_s = 0;
+
/**
@brief
Non-initialising constructor.
*/
Game::Game(int argc, char** argv)
{
- assert(singletonRef_s == 0);
+ if (singletonRef_s != 0)
+ {
+ COUT(0) << "Error: The Game singleton cannot be recreated! Shutting down." << std::endl;
+ abort();
+ }
singletonRef_s = this;
this->bAbort_ = false;
bChangingState_ = false;
- // The empty root state is ALWAYS loaded!
- this->rootStateNode_ = shared_ptr<GameStateTreeNode>(new GameStateTreeNode());
- this->rootStateNode_->state_ = getState("emptyRootGameState");
- this->activeStateNode_ = this->rootStateNode_;
- this->activeStates_.push_back(this->rootStateNode_->state_);
+ // Create an empty root state
+ declareGameState<GameState>("GameState", "emptyRootGameState", true, false);
+
// reset statistics
this->statisticsStartTime_ = 0;
this->statisticsTickTimes_.clear();
@@ -97,9 +97,27 @@
// Set up a basic clock to keep time
this->gameClock_ = new Clock();
+ // Create the Core
this->core_ = new orxonox::Core();
this->core_->initialise(argc, argv);
+ // After the core has been created, we can safely instantiate the GameStates
+ for (std::map<std::string, GameStateInfo>::const_iterator it = gameStateDeclarations_s.begin();
+ it != gameStateDeclarations_s.end(); ++it)
+ {
+ // Only create the states appropriate for the game mode
+ //if (GameMode::showsGraphics || !it->second.bGraphicsMode)
+ GameStateConstrParams params = { it->second.stateName, it->second.bIgnoreTickTime };
+ gameStates_[getLowercase(it->second.stateName)] = GameStateFactory::fabricate(it->second.className, params);
+ }
+
+ // The empty root state is ALWAYS loaded!
+ this->rootStateNode_ = shared_ptr<GameStateTreeNode>(new GameStateTreeNode());
+ this->rootStateNode_->state_ = getState("emptyRootGameState");
+ this->activeStateNode_ = this->rootStateNode_;
+ this->activeStates_.push_back(this->rootStateNode_->state_);
+
+ // Do this after Core creation!
RegisterRootObject(Game);
this->setConfigValues();
}
@@ -109,13 +127,19 @@
*/
Game::~Game()
{
- // Destroy pretty much everyhting left
+ // Destroy the GameStates (note that the nodes still point to them, but doesn't matter)
+ for (std::map<std::string, GameState*>::const_iterator it = gameStates_.begin();
+ it != gameStates_.end(); ++it)
+ delete it->second;
+
+ // Destroy the Core and with it almost everything
delete this->core_;
-
delete this->gameClock_;
- assert(singletonRef_s);
- singletonRef_s = 0;
+ // Also, take care of the GameStateFactories
+ GameStateFactory::destroyFactories();
+
+ // Don't assign singletonRef_s with NULL! Recreation is not supported
}
void Game::setConfigValues()
@@ -164,7 +188,7 @@
uint64_t currentTime = this->gameClock_->getMicroseconds();
// STATISTICS
- statisticsTickInfo tickInfo = {currentTime, 0};
+ StatisticsTickInfo tickInfo = {currentTime, 0};
statisticsTickTimes_.push_back(tickInfo);
this->periodTime_ += this->gameClock_->getDeltaTimeMicroseconds();
@@ -239,7 +263,7 @@
// STATISTICS
if (this->periodTime_ > statisticsRefreshCycle_)
{
- std::list<statisticsTickInfo>::iterator it = this->statisticsTickTimes_.begin();
+ std::list<StatisticsTickInfo>::iterator it = this->statisticsTickTimes_.begin();
assert(it != this->statisticsTickTimes_.end());
int64_t lastTime = currentTime - this->statisticsAvgLength_;
if ((int64_t)it->tickTime < lastTime)
@@ -355,8 +379,8 @@
GameState* Game::getState(const std::string& name)
{
- std::map<std::string, GameState*>::const_iterator it = allStates_s.find(getLowercase(name));
- if (it != allStates_s.end())
+ std::map<std::string, GameState*>::const_iterator it = gameStates_.find(getLowercase(name));
+ if (it != gameStates_.end())
return it->second;
else
{
@@ -447,23 +471,19 @@
this->bChangingState_ = false;
}
- /*static*/ bool Game::addGameState(GameState* state)
+ std::map<std::string, Game::GameStateFactory*> Game::GameStateFactory::factories_s;
+
+ /*static*/ GameState* Game::GameStateFactory::fabricate(const std::string& className, const GameStateConstrParams& params)
{
- std::map<std::string, GameState*>::const_iterator it = allStates_s.find(getLowercase(state->getName()));
- if (it == allStates_s.end())
- allStates_s[getLowercase(state->getName())] = state;
- else
- ThrowException(GameState, "Cannot add two GameStates with the same name to 'Game'.");
-
- // just a required dummy return value
- return true;
+ std::map<std::string, GameStateFactory*>::const_iterator it = factories_s.find(className);
+ assert(it != factories_s.end());
+ return it->second->fabricate(params);
}
- /*static*/ void Game::destroyStates()
+ /*static*/ void Game::GameStateFactory::destroyFactories()
{
- // Delete all GameStates created by the macros
- for (std::map<std::string, GameState*>::const_iterator it = allStates_s.begin(); it != allStates_s.end(); ++it)
+ for (std::map<std::string, GameStateFactory*>::const_iterator it = factories_s.begin(); it != factories_s.end(); ++it)
delete it->second;
- allStates_s.clear();
+ factories_s.clear();
}
}
Modified: branches/core4/src/core/Game.h
===================================================================
--- branches/core4/src/core/Game.h 2009-06-28 15:35:50 UTC (rev 3242)
+++ branches/core4/src/core/Game.h 2009-06-28 16:22:40 UTC (rev 3243)
@@ -45,6 +45,7 @@
#include <boost/shared_ptr.hpp>
#include <boost/preprocessor/cat.hpp>
+#include "util/Debug.h"
#include "OrxonoxClass.h"
/**
@@ -52,8 +53,8 @@
Adds a new GameState to the Game. The second parameter is the name as string
and every following paramter is a constructor argument (which is usually non existent)
*/
-#define AddGameState(classname, ...) \
- static bool BOOST_PP_CAT(bGameStateDummy_##classname, __LINE__) = orxonox::Game::addGameState(new classname(__VA_ARGS__))
+#define DeclareGameState(className, stateName, bIgnoreTickTime, bGraphicsMode) \
+ static bool BOOST_PP_CAT(bGameStateDummy_##className, __LINE__) = orxonox::Game::declareGameState<className>(#className, stateName, bIgnoreTickTime, bGraphicsMode)
// tolua_begin
namespace orxonox
@@ -90,16 +91,45 @@
void addTickTime(uint32_t length);
- static bool addGameState(GameState* state);
- static void destroyStates();
+ template <class T>
+ static bool declareGameState(const std::string& className, const std::string& stateName, bool bIgnoreTickTime, bool bConsoleMode);
static Game& getInstance() { assert(singletonRef_s); return *singletonRef_s; } //tolua_export
void setLevel(std::string levelName); //tolua_export
std::string getLevel(); //tolua_export
private:
- struct statisticsTickInfo
+ class _CoreExport GameStateFactory
{
+ public:
+ virtual ~GameStateFactory() { }
+ static GameState* fabricate(const std::string& className, const GameStateConstrParams& params);
+ template <class T>
+ static void createFactory(const std::string& className)
+ { factories_s[className] = new TemplateGameStateFactory<T>(); }
+ static void destroyFactories();
+ private:
+ virtual GameState* fabricate(const GameStateConstrParams& params) = 0;
+ static std::map<std::string, GameStateFactory*> factories_s;
+ };
+ template <class T>
+ class TemplateGameStateFactory : public GameStateFactory
+ {
+ public:
+ GameState* fabricate(const GameStateConstrParams& params)
+ { return new T(params); }
+ };
+
+ struct GameStateInfo
+ {
+ std::string stateName;
+ std::string className;
+ bool bIgnoreTickTime;
+ bool bGraphicsMode;
+ };
+
+ struct StatisticsTickInfo
+ {
uint64_t tickTime;
uint32_t tickLength;
};
@@ -109,7 +139,8 @@
void loadState(GameState* state);
void unloadState(GameState* state);
- std::vector<GameState*> activeStates_;
+ std::map<std::string, GameState*> gameStates_;
+ std::vector<GameState*> activeStates_;
boost::shared_ptr<GameStateTreeNode> rootStateNode_;
boost::shared_ptr<GameStateTreeNode> activeStateNode_;
std::vector<boost::shared_ptr<GameStateTreeNode> > requestedStateNodes_;
@@ -122,7 +153,7 @@
// variables for time statistics
uint64_t statisticsStartTime_;
- std::list<statisticsTickInfo> statisticsTickTimes_;
+ std::list<StatisticsTickInfo> statisticsTickTimes_;
uint32_t periodTime_;
uint32_t periodTickTime_;
float avgFPS_;
@@ -133,10 +164,34 @@
unsigned int statisticsAvgLength_;
std::string levelName_;
- static std::map<std::string, GameState*> allStates_s;
+ static std::map<std::string, GameStateInfo> gameStateDeclarations_s;
static Game* singletonRef_s; //!< Pointer to the Singleton
- // tolua_begin
- };
-}
-//tolua_end
+ }; // tolua_export
+
+ template <class T>
+ /*static*/ bool Game::declareGameState(const std::string& className, const std::string& stateName, bool bIgnoreTickTime, bool bGraphicsMode)
+ {
+ std::map<std::string, GameStateInfo>::const_iterator it = gameStateDeclarations_s.find(getLowercase(stateName));
+ if (it == gameStateDeclarations_s.end())
+ {
+ GameStateInfo& info = gameStateDeclarations_s[getLowercase(stateName)];
+ info.stateName = stateName;
+ info.className = className;
+ info.bIgnoreTickTime = bIgnoreTickTime;
+ info.bGraphicsMode = bGraphicsMode;
+ }
+ else
+ {
+ COUT(0) << "Error: Cannot declare two GameStates with the same name." << std::endl;
+ COUT(0) << " Ignoring second one ('" << stateName << "')." << std::endl;
+ }
+
+ // Create a factory to delay GameState creation
+ GameStateFactory::createFactory<T>(className);
+
+ // just a required dummy return value
+ return true;
+ }
+} // tolua_export
+
#endif /* _Game_H__ */
Modified: branches/core4/src/core/GameState.cc
===================================================================
--- branches/core4/src/core/GameState.cc 2009-06-28 15:35:50 UTC (rev 3242)
+++ branches/core4/src/core/GameState.cc 2009-06-28 16:22:40 UTC (rev 3243)
@@ -44,9 +44,9 @@
@brief
Constructor only initialises variables and sets the name permanently.
*/
- GameState::GameState(const std::string& name, bool ignoreTickTime)
- : name_(name)
- , bIgnoreTickTime_(ignoreTickTime)
+ GameState::GameState(const GameStateConstrParams& params)
+ : name_(params.name)
+ , bIgnoreTickTime_(params.bIgnoreTickTime)
, parent_(0)
{
this->activity_.activating = false;
Modified: branches/core4/src/core/GameState.h
===================================================================
--- branches/core4/src/core/GameState.h 2009-06-28 15:35:50 UTC (rev 3242)
+++ branches/core4/src/core/GameState.h 2009-06-28 16:22:40 UTC (rev 3243)
@@ -44,6 +44,16 @@
{
/**
@brief
+ Helper class to group construction parameters for better genericity.
+ */
+ struct GameStateConstrParams
+ {
+ std::string name;
+ bool bIgnoreTickTime;
+ };
+
+ /**
+ @brief
An implementation of a tree to manage game states.
This leads to a certain hierarchy that is created at runtime.
To actually use the structure, you will have to derive from it and
@@ -76,7 +86,7 @@
};
public:
- GameState(const std::string& name, bool ignoreTicktime = false);
+ GameState(const GameStateConstrParams& params);
virtual ~GameState();
const std::string& getName() const { return name_; }
Modified: branches/core4/src/orxonox/Main.cc
===================================================================
--- branches/core4/src/orxonox/Main.cc 2009-06-28 15:35:50 UTC (rev 3242)
+++ branches/core4/src/orxonox/Main.cc 2009-06-28 16:22:40 UTC (rev 3243)
@@ -69,11 +69,8 @@
orxonox.requestState("root");
orxonox.run();
+ }
- // destroy the GameStates created pre-mainly
- orxonox::Game::destroyStates();
- } // orxonox gets destroyed right here!
-
// Clean up class hierarchy stuff (identifiers, xmlport, configvalue, consolecommand)
// Needs to be done after Game destructor because of ~OrxonoxClass
orxonox::Identifier::destroyAllIdentifiers();
Modified: branches/core4/src/orxonox/gamestates/GSClient.cc
===================================================================
--- branches/core4/src/orxonox/gamestates/GSClient.cc 2009-06-28 15:35:50 UTC (rev 3242)
+++ branches/core4/src/orxonox/gamestates/GSClient.cc 2009-06-28 16:22:40 UTC (rev 3243)
@@ -37,12 +37,12 @@
namespace orxonox
{
- AddGameState(GSClient, "client");
+ DeclareGameState(GSClient, "client", false, true);
SetCommandLineArgument(ip, "127.0.0.1").information("#.#.#.#");
- GSClient::GSClient(const std::string& name)
- : GameState(name)
+ GSClient::GSClient(const GameStateConstrParams& params)
+ : GameState(params)
, client_(0)
{
}
Modified: branches/core4/src/orxonox/gamestates/GSClient.h
===================================================================
--- branches/core4/src/orxonox/gamestates/GSClient.h 2009-06-28 15:35:50 UTC (rev 3242)
+++ branches/core4/src/orxonox/gamestates/GSClient.h 2009-06-28 16:22:40 UTC (rev 3243)
@@ -39,7 +39,7 @@
class _OrxonoxExport GSClient : public GameState
{
public:
- GSClient(const std::string& name);
+ GSClient(const GameStateConstrParams& params);
~GSClient();
void activate();
Modified: branches/core4/src/orxonox/gamestates/GSDedicated.cc
===================================================================
--- branches/core4/src/orxonox/gamestates/GSDedicated.cc 2009-06-28 15:35:50 UTC (rev 3242)
+++ branches/core4/src/orxonox/gamestates/GSDedicated.cc 2009-06-28 16:22:40 UTC (rev 3243)
@@ -50,12 +50,12 @@
{
const unsigned int MAX_COMMAND_LENGTH = 255;
- AddGameState(GSDedicated, "dedicated");
+ DeclareGameState(GSDedicated, "dedicated", false, false);
termios* GSDedicated::originalTerminalSettings_;
- GSDedicated::GSDedicated(const std::string& name)
- : GameState(name)
+ GSDedicated::GSDedicated(const GameStateConstrParams& params)
+ : GameState(params)
, server_(0)
, timeSinceLastUpdate_(0)
, closeThread_(false)
Modified: branches/core4/src/orxonox/gamestates/GSDedicated.h
===================================================================
--- branches/core4/src/orxonox/gamestates/GSDedicated.h 2009-06-28 15:35:50 UTC (rev 3242)
+++ branches/core4/src/orxonox/gamestates/GSDedicated.h 2009-06-28 16:22:40 UTC (rev 3243)
@@ -47,7 +47,7 @@
class _OrxonoxExport GSDedicated : public GameState
{
public:
- GSDedicated(const std::string& name);
+ GSDedicated(const GameStateConstrParams& params);
~GSDedicated();
void activate();
Modified: branches/core4/src/orxonox/gamestates/GSGraphics.cc
===================================================================
--- branches/core4/src/orxonox/gamestates/GSGraphics.cc 2009-06-28 15:35:50 UTC (rev 3242)
+++ branches/core4/src/orxonox/gamestates/GSGraphics.cc 2009-06-28 16:22:40 UTC (rev 3243)
@@ -56,10 +56,10 @@
namespace orxonox
{
- AddGameState(GSGraphics, "graphics", true);
+ DeclareGameState(GSGraphics, "graphics", true, true);
- GSGraphics::GSGraphics(const std::string& name, bool countTickTime)
- : GameState(name, countTickTime)
+ GSGraphics::GSGraphics(const GameStateConstrParams& params)
+ : GameState(params)
, inputManager_(0)
, console_(0)
, guiManager_(0)
Modified: branches/core4/src/orxonox/gamestates/GSGraphics.h
===================================================================
--- branches/core4/src/orxonox/gamestates/GSGraphics.h 2009-06-28 15:35:50 UTC (rev 3242)
+++ branches/core4/src/orxonox/gamestates/GSGraphics.h 2009-06-28 16:22:40 UTC (rev 3243)
@@ -51,7 +51,7 @@
class _OrxonoxExport GSGraphics : public GameState, public WindowEventListener
{
public:
- GSGraphics(const std::string& name, bool countTickTime);
+ GSGraphics(const GameStateConstrParams& params);
~GSGraphics();
void setConfigValues();
Modified: branches/core4/src/orxonox/gamestates/GSIOConsole.cc
===================================================================
--- branches/core4/src/orxonox/gamestates/GSIOConsole.cc 2009-06-28 15:35:50 UTC (rev 3242)
+++ branches/core4/src/orxonox/gamestates/GSIOConsole.cc 2009-06-28 16:22:40 UTC (rev 3243)
@@ -35,10 +35,10 @@
namespace orxonox
{
- AddGameState(GSIOConsole, "ioConsole");
+ DeclareGameState(GSIOConsole, "ioConsole", false, false);
- GSIOConsole::GSIOConsole(const std::string& name)
- : GameState(name)
+ GSIOConsole::GSIOConsole(const GameStateConstrParams& params)
+ : GameState(params)
{
}
Modified: branches/core4/src/orxonox/gamestates/GSIOConsole.h
===================================================================
--- branches/core4/src/orxonox/gamestates/GSIOConsole.h 2009-06-28 15:35:50 UTC (rev 3242)
+++ branches/core4/src/orxonox/gamestates/GSIOConsole.h 2009-06-28 16:22:40 UTC (rev 3243)
@@ -37,7 +37,7 @@
class _OrxonoxExport GSIOConsole : public GameState
{
public:
- GSIOConsole(const std::string& name);
+ GSIOConsole(const GameStateConstrParams& params);
~GSIOConsole();
void activate();
Modified: branches/core4/src/orxonox/gamestates/GSLevel.cc
===================================================================
--- branches/core4/src/orxonox/gamestates/GSLevel.cc 2009-06-28 15:35:50 UTC (rev 3242)
+++ branches/core4/src/orxonox/gamestates/GSLevel.cc 2009-06-28 16:22:40 UTC (rev 3243)
@@ -55,15 +55,15 @@
namespace orxonox
{
- AddGameState(GSLevel, "level");
+ DeclareGameState(GSLevel, "level", false, true);
SetCommandLineArgument(level, "").shortcut("l");
SetConsoleCommand(GSLevel, showIngameGUI, true);
XMLFile* GSLevel::startFile_s = NULL;
- GSLevel::GSLevel(const std::string& name)
- : GameState(name)
+ GSLevel::GSLevel(const GameStateConstrParams& params)
+ : GameState(params)
, keyBinder_(0)
, gameInputState_(0)
, guiMouseOnlyInputState_(0)
Modified: branches/core4/src/orxonox/gamestates/GSLevel.h
===================================================================
--- branches/core4/src/orxonox/gamestates/GSLevel.h 2009-06-28 15:35:50 UTC (rev 3242)
+++ branches/core4/src/orxonox/gamestates/GSLevel.h 2009-06-28 16:22:40 UTC (rev 3243)
@@ -40,7 +40,7 @@
class _OrxonoxExport GSLevel : public GameState, public OrxonoxClass
{
public:
- GSLevel(const std::string& name);
+ GSLevel(const GameStateConstrParams& params);
~GSLevel();
void setConfigValues();
Modified: branches/core4/src/orxonox/gamestates/GSMainMenu.cc
===================================================================
--- branches/core4/src/orxonox/gamestates/GSMainMenu.cc 2009-06-28 15:35:50 UTC (rev 3242)
+++ branches/core4/src/orxonox/gamestates/GSMainMenu.cc 2009-06-28 16:22:40 UTC (rev 3243)
@@ -42,10 +42,10 @@
namespace orxonox
{
- AddGameState(GSMainMenu, "mainMenu");
+ DeclareGameState(GSMainMenu, "mainMenu", false, true);
- GSMainMenu::GSMainMenu(const std::string& name)
- : GameState(name)
+ GSMainMenu::GSMainMenu(const GameStateConstrParams& params)
+ : GameState(params)
, inputState_(0)
{
}
Modified: branches/core4/src/orxonox/gamestates/GSMainMenu.h
===================================================================
--- branches/core4/src/orxonox/gamestates/GSMainMenu.h 2009-06-28 15:35:50 UTC (rev 3242)
+++ branches/core4/src/orxonox/gamestates/GSMainMenu.h 2009-06-28 16:22:40 UTC (rev 3243)
@@ -39,7 +39,7 @@
class _OrxonoxExport GSMainMenu : public GameState
{
public:
- GSMainMenu(const std::string& name);
+ GSMainMenu(const GameStateConstrParams& params);
~GSMainMenu();
void activate();
Modified: branches/core4/src/orxonox/gamestates/GSRoot.cc
===================================================================
--- branches/core4/src/orxonox/gamestates/GSRoot.cc 2009-06-28 15:35:50 UTC (rev 3242)
+++ branches/core4/src/orxonox/gamestates/GSRoot.cc 2009-06-28 16:22:40 UTC (rev 3243)
@@ -39,7 +39,7 @@
namespace orxonox
{
- AddGameState(GSRoot, "root", true);
+ DeclareGameState(GSRoot, "root", true, false);
SetCommandLineSwitch(console);
// Shortcuts for easy direct loading
SetCommandLineSwitch(server);
@@ -47,8 +47,8 @@
SetCommandLineSwitch(dedicated);
SetCommandLineSwitch(standalone);
- GSRoot::GSRoot(const std::string& name, bool countTickTime)
- : GameState(name, countTickTime)
+ GSRoot::GSRoot(const GameStateConstrParams& params)
+ : GameState(params)
, timeFactor_(1.0f)
, bPaused_(false)
, timeFactorPauseBackup_(1.0f)
Modified: branches/core4/src/orxonox/gamestates/GSRoot.h
===================================================================
--- branches/core4/src/orxonox/gamestates/GSRoot.h 2009-06-28 15:35:50 UTC (rev 3242)
+++ branches/core4/src/orxonox/gamestates/GSRoot.h 2009-06-28 16:22:40 UTC (rev 3243)
@@ -37,7 +37,7 @@
class _OrxonoxExport GSRoot : public GameState
{
public:
- GSRoot(const std::string& name, bool countTickTime);
+ GSRoot(const GameStateConstrParams& params);
~GSRoot();
void activate();
Modified: branches/core4/src/orxonox/gamestates/GSServer.cc
===================================================================
--- branches/core4/src/orxonox/gamestates/GSServer.cc 2009-06-28 15:35:50 UTC (rev 3242)
+++ branches/core4/src/orxonox/gamestates/GSServer.cc 2009-06-28 16:22:40 UTC (rev 3243)
@@ -36,12 +36,12 @@
namespace orxonox
{
- AddGameState(GSServer, "server");
+ DeclareGameState(GSServer, "server", false, true);
SetCommandLineArgument(port, 55556).shortcut("p").information("0-65535");
- GSServer::GSServer(const std::string& name)
- : GameState(name)
+ GSServer::GSServer(const GameStateConstrParams& params)
+ : GameState(params)
, server_(0)
{
}
Modified: branches/core4/src/orxonox/gamestates/GSServer.h
===================================================================
--- branches/core4/src/orxonox/gamestates/GSServer.h 2009-06-28 15:35:50 UTC (rev 3242)
+++ branches/core4/src/orxonox/gamestates/GSServer.h 2009-06-28 16:22:40 UTC (rev 3243)
@@ -39,7 +39,7 @@
class _OrxonoxExport GSServer : public GameState
{
public:
- GSServer(const std::string& name);
+ GSServer(const GameStateConstrParams& params);
~GSServer();
void activate();
Modified: branches/core4/src/orxonox/gamestates/GSStandalone.cc
===================================================================
--- branches/core4/src/orxonox/gamestates/GSStandalone.cc 2009-06-28 15:35:50 UTC (rev 3242)
+++ branches/core4/src/orxonox/gamestates/GSStandalone.cc 2009-06-28 16:22:40 UTC (rev 3243)
@@ -33,10 +33,10 @@
namespace orxonox
{
- AddGameState(GSStandalone, "standalone");
+ DeclareGameState(GSStandalone, "standalone", false, true);
- GSStandalone::GSStandalone(const std::string& name)
- : GameState(name)
+ GSStandalone::GSStandalone(const GameStateConstrParams& params)
+ : GameState(params)
{
}
Modified: branches/core4/src/orxonox/gamestates/GSStandalone.h
===================================================================
--- branches/core4/src/orxonox/gamestates/GSStandalone.h 2009-06-28 15:35:50 UTC (rev 3242)
+++ branches/core4/src/orxonox/gamestates/GSStandalone.h 2009-06-28 16:22:40 UTC (rev 3243)
@@ -37,7 +37,7 @@
class _OrxonoxExport GSStandalone : public GameState
{
public:
- GSStandalone(const std::string& name);
+ GSStandalone(const GameStateConstrParams& params);
~GSStandalone();
void activate();
More information about the Orxonox-commit
mailing list