diff options
author | Piotr Dziwinski <piotrdz@gmail.com> | 2013-03-30 15:01:00 +0100 |
---|---|---|
committer | Piotr Dziwinski <piotrdz@gmail.com> | 2013-03-30 15:23:05 +0100 |
commit | e218dcfdf2c58f8841e7ebd220527d08e870a6d5 (patch) | |
tree | a567db04a8a51e2db87f80e259faf222a7d4becd /src/app/main.cpp | |
parent | bfc701e286259d9a7aa2ff8240704eab2ba3a237 (diff) | |
parent | e607fed265070be8c518d4302d8b76f738421fb3 (diff) | |
download | colobot-e218dcfdf2c58f8841e7ebd220527d08e870a6d5.tar.gz colobot-e218dcfdf2c58f8841e7ebd220527d08e870a6d5.tar.bz2 colobot-e218dcfdf2c58f8841e7ebd220527d08e870a6d5.zip |
Merge branch 'dev'
Merging content from dev
Diffstat (limited to 'src/app/main.cpp')
-rw-r--r-- | src/app/main.cpp | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/src/app/main.cpp b/src/app/main.cpp index e621065..edb5828 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -23,6 +23,7 @@ #include "app/app.h" #include "app/system.h" +#include "common/config.h" #include "common/logger.h" #include "common/misc.h" #include "common/restext.h" @@ -70,44 +71,54 @@ The current layout is the following: //! Entry point to the program -int main(int argc, char *argv[]) +extern "C" { - CLogger logger; // Create the logger - InitializeRestext(); // Initialize translation strings +int SDL_MAIN_FUNC(int argc, char *argv[]) +{ + CLogger logger; // single istance of logger + + InitializeRestext(); // init static translation strings + + CSystemUtils* systemUtils = CSystemUtils::Create(); // platform-specific utils + systemUtils->Init(); logger.Info("Colobot starting\n"); - CApplication app; // single instance of the application + CApplication* app = new CApplication(); // single instance of the application - ParseArgsStatus status = app.ParseArguments(argc, argv); + ParseArgsStatus status = app->ParseArguments(argc, argv); if (status == PARSE_ARGS_FAIL) { - SystemDialog(SDT_ERROR, "COLOBOT - Fatal Error", "Invalid commandline arguments!\n"); - return app.GetExitCode(); + systemUtils->SystemDialog(SDT_ERROR, "COLOBOT - Fatal Error", "Invalid commandline arguments!\n"); + return app->GetExitCode(); } else if (status == PARSE_ARGS_HELP) { - return app.GetExitCode(); + return app->GetExitCode(); } int code = 0; - if (! app.Create()) + if (! app->Create()) { - app.Destroy(); // ensure a clean exit - code = app.GetExitCode(); - if ( code != 0 && !app.GetErrorMessage().empty() ) + app->Destroy(); // ensure a clean exit + code = app->GetExitCode(); + if ( code != 0 && !app->GetErrorMessage().empty() ) { - SystemDialog(SDT_ERROR, "COLOBOT - Fatal Error", app.GetErrorMessage()); + systemUtils->SystemDialog(SDT_ERROR, "COLOBOT - Fatal Error", app->GetErrorMessage()); } logger.Info("Didn't run main loop. Exiting with code %d\n", code); return code; } - code = app.Run(); + code = app->Run(); + + delete app; + delete systemUtils; logger.Info("Exiting with code %d\n", code); return code; } +} // extern "C" |