Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 29, 2009, 2:01:51 PM (15 years ago)
Author:
rgrieder
Message:

Removed OrxonoxClass inheritance from Game and Core: this allows the Core class to deal with everything core-related, including identifier destruction.
Instead I moved the config-values to CoreConfiguration and GameConfiguration which in turn are member variables (as pointers).
Also handled exceptions better: Game or Core must not fail to initialise, otherwise orxonox will not start. This now gets displayed properly.

File:
1 edited

Legend:

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

    r3243 r3247  
    3737
    3838#include "util/Debug.h"
    39 #include "core/Identifier.h"
     39#include "util/Exception.h"
    4040#include "core/Game.h"
    4141
     
    5050#endif
    5151{
     52    using namespace orxonox;
     53
     54    Game* game = 0;
     55    try
    5256    {
    53         orxonox::Game orxonox(argc, argv);
     57        game = new Game(argc, argv);
    5458
    55         orxonox.setStateHierarchy(
     59        game->setStateHierarchy(
    5660        "root"
    5761        " graphics"
     
    6872        );
    6973
    70         orxonox.requestState("root");
    71         orxonox.run();
     74        game->requestState("root");
     75    }
     76    catch (const std::exception& ex)
     77    {
     78        COUT(0) << "Orxonox failed to initialise: " << ex.what() << std::endl;
     79        COUT(0) << "Terminating program." << std::endl;
     80        return 1;
     81    }
     82    catch (...)
     83    {
     84        COUT(0) << "Orxonox failed to initialise: " << std::endl;
     85        COUT(0) << "Terminating program." << std::endl;
     86        return 1;
    7287    }
    7388
    74     // Clean up class hierarchy stuff (identifiers, xmlport, configvalue, consolecommand)
    75     // Needs to be done after Game destructor because of ~OrxonoxClass
    76     orxonox::Identifier::destroyAllIdentifiers();
     89    game->run();
    7790
    7891    return 0;
Note: See TracChangeset for help on using the changeset viewer.