Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 28, 2009, 6:22:40 PM (15 years ago)
Author:
rgrieder
Message:

Moved GameState construction from pre-main() to after Core creation. That makes it possible to use Core features (like configValues) in the GameState constructor.

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

Legend:

Unmodified
Added
Removed
  • code/branches/core4/src/orxonox/Main.cc

    r3238 r3243  
    7070        orxonox.requestState("root");
    7171        orxonox.run();
    72 
    73         // destroy the GameStates created pre-mainly
    74         orxonox::Game::destroyStates();
    75     } // orxonox gets destroyed right here!
     72    }
    7673
    7774    // Clean up class hierarchy stuff (identifiers, xmlport, configvalue, consolecommand)
  • code/branches/core4/src/orxonox/gamestates/GSClient.cc

    r3196 r3243  
    3838namespace orxonox
    3939{
    40     AddGameState(GSClient, "client");
     40    DeclareGameState(GSClient, "client", false, true);
    4141
    4242    SetCommandLineArgument(ip, "127.0.0.1").information("#.#.#.#");
    4343
    44     GSClient::GSClient(const std::string& name)
    45         : GameState(name)
     44    GSClient::GSClient(const GameStateConstrParams& params)
     45        : GameState(params)
    4646        , client_(0)
    4747    {
  • code/branches/core4/src/orxonox/gamestates/GSClient.h

    r3196 r3243  
    4040    {
    4141    public:
    42         GSClient(const std::string& name);
     42        GSClient(const GameStateConstrParams& params);
    4343        ~GSClient();
    4444
  • code/branches/core4/src/orxonox/gamestates/GSDedicated.cc

    r3205 r3243  
    5151    const unsigned int MAX_COMMAND_LENGTH = 255;
    5252   
    53     AddGameState(GSDedicated, "dedicated");
     53    DeclareGameState(GSDedicated, "dedicated", false, false);
    5454   
    5555    termios* GSDedicated::originalTerminalSettings_;
    5656
    57     GSDedicated::GSDedicated(const std::string& name)
    58         : GameState(name)
     57    GSDedicated::GSDedicated(const GameStateConstrParams& params)
     58        : GameState(params)
    5959        , server_(0)
    6060        , timeSinceLastUpdate_(0)
  • code/branches/core4/src/orxonox/gamestates/GSDedicated.h

    r3198 r3243  
    4848    {
    4949    public:
    50         GSDedicated(const std::string& name);
     50        GSDedicated(const GameStateConstrParams& params);
    5151        ~GSDedicated();
    5252
  • code/branches/core4/src/orxonox/gamestates/GSGraphics.cc

    r3238 r3243  
    5757namespace orxonox
    5858{
    59     AddGameState(GSGraphics, "graphics", true);
    60 
    61     GSGraphics::GSGraphics(const std::string& name, bool countTickTime)
    62         : GameState(name, countTickTime)
     59    DeclareGameState(GSGraphics, "graphics", true, true);
     60
     61    GSGraphics::GSGraphics(const GameStateConstrParams& params)
     62        : GameState(params)
    6363        , inputManager_(0)
    6464        , console_(0)
  • code/branches/core4/src/orxonox/gamestates/GSGraphics.h

    r3196 r3243  
    5252    {
    5353    public:
    54         GSGraphics(const std::string& name, bool countTickTime);
     54        GSGraphics(const GameStateConstrParams& params);
    5555        ~GSGraphics();
    5656        void setConfigValues();
  • code/branches/core4/src/orxonox/gamestates/GSIOConsole.cc

    r3196 r3243  
    3636namespace orxonox
    3737{
    38     AddGameState(GSIOConsole, "ioConsole");
     38    DeclareGameState(GSIOConsole, "ioConsole", false, false);
    3939
    40     GSIOConsole::GSIOConsole(const std::string& name)
    41         : GameState(name)
     40    GSIOConsole::GSIOConsole(const GameStateConstrParams& params)
     41        : GameState(params)
    4242    {
    4343    }
  • code/branches/core4/src/orxonox/gamestates/GSIOConsole.h

    r2896 r3243  
    3838    {
    3939    public:
    40         GSIOConsole(const std::string& name);
     40        GSIOConsole(const GameStateConstrParams& params);
    4141        ~GSIOConsole();
    4242
  • code/branches/core4/src/orxonox/gamestates/GSLevel.cc

    r3196 r3243  
    5656namespace orxonox
    5757{
    58     AddGameState(GSLevel, "level");
     58    DeclareGameState(GSLevel, "level", false, true);
    5959
    6060    SetCommandLineArgument(level, "").shortcut("l");
     
    6363    XMLFile* GSLevel::startFile_s = NULL;
    6464
    65     GSLevel::GSLevel(const std::string& name)
    66         : GameState(name)
     65    GSLevel::GSLevel(const GameStateConstrParams& params)
     66        : GameState(params)
    6767        , keyBinder_(0)
    6868        , gameInputState_(0)
  • code/branches/core4/src/orxonox/gamestates/GSLevel.h

    r3196 r3243  
    4141    {
    4242    public:
    43         GSLevel(const std::string& name);
     43        GSLevel(const GameStateConstrParams& params);
    4444        ~GSLevel();
    4545        void setConfigValues();
  • code/branches/core4/src/orxonox/gamestates/GSMainMenu.cc

    r3196 r3243  
    4343namespace orxonox
    4444{
    45     AddGameState(GSMainMenu, "mainMenu");
     45    DeclareGameState(GSMainMenu, "mainMenu", false, true);
    4646
    47     GSMainMenu::GSMainMenu(const std::string& name)
    48         : GameState(name)
     47    GSMainMenu::GSMainMenu(const GameStateConstrParams& params)
     48        : GameState(params)
    4949        , inputState_(0)
    5050    {
  • code/branches/core4/src/orxonox/gamestates/GSMainMenu.h

    r3196 r3243  
    4040    {
    4141    public:
    42         GSMainMenu(const std::string& name);
     42        GSMainMenu(const GameStateConstrParams& params);
    4343        ~GSMainMenu();
    4444
  • code/branches/core4/src/orxonox/gamestates/GSRoot.cc

    r3238 r3243  
    4040namespace orxonox
    4141{
    42     AddGameState(GSRoot, "root", true);
     42    DeclareGameState(GSRoot, "root", true, false);
    4343    SetCommandLineSwitch(console);
    4444    // Shortcuts for easy direct loading
     
    4848    SetCommandLineSwitch(standalone);
    4949
    50     GSRoot::GSRoot(const std::string& name, bool countTickTime)
    51         : GameState(name, countTickTime)
     50    GSRoot::GSRoot(const GameStateConstrParams& params)
     51        : GameState(params)
    5252        , timeFactor_(1.0f)
    5353        , bPaused_(false)
  • code/branches/core4/src/orxonox/gamestates/GSRoot.h

    r3196 r3243  
    3838    {
    3939    public:
    40         GSRoot(const std::string& name, bool countTickTime);
     40        GSRoot(const GameStateConstrParams& params);
    4141        ~GSRoot();
    4242
  • code/branches/core4/src/orxonox/gamestates/GSServer.cc

    r3196 r3243  
    3737namespace orxonox
    3838{
    39     AddGameState(GSServer, "server");
     39    DeclareGameState(GSServer, "server", false, true);
    4040
    4141    SetCommandLineArgument(port, 55556).shortcut("p").information("0-65535");
    4242
    43     GSServer::GSServer(const std::string& name)
    44         : GameState(name)
     43    GSServer::GSServer(const GameStateConstrParams& params)
     44        : GameState(params)
    4545        , server_(0)
    4646    {
  • code/branches/core4/src/orxonox/gamestates/GSServer.h

    r3196 r3243  
    4040    {
    4141    public:
    42         GSServer(const std::string& name);
     42        GSServer(const GameStateConstrParams& params);
    4343        ~GSServer();
    4444
  • code/branches/core4/src/orxonox/gamestates/GSStandalone.cc

    r3196 r3243  
    3434namespace orxonox
    3535{
    36     AddGameState(GSStandalone, "standalone");
     36    DeclareGameState(GSStandalone, "standalone", false, true);
    3737
    38     GSStandalone::GSStandalone(const std::string& name)
    39         : GameState(name)
     38    GSStandalone::GSStandalone(const GameStateConstrParams& params)
     39        : GameState(params)
    4040    {
    4141    }
  • code/branches/core4/src/orxonox/gamestates/GSStandalone.h

    r2896 r3243  
    3838    {
    3939    public:
    40         GSStandalone(const std::string& name);
     40        GSStandalone(const GameStateConstrParams& params);
    4141        ~GSStandalone();
    4242
Note: See TracChangeset for help on using the changeset viewer.