summaryrefslogtreecommitdiffstats
path: root/src/app/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/app/main.cpp')
-rw-r--r--src/app/main.cpp32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/app/main.cpp b/src/app/main.cpp
index 0622370..edb5828 100644
--- a/src/app/main.cpp
+++ b/src/app/main.cpp
@@ -76,40 +76,46 @@ extern "C"
int SDL_MAIN_FUNC(int argc, char *argv[])
{
- CLogger logger; // Create the logger
+ CLogger logger; // single istance of logger
- InitializeRestext(); // Initialize translation strings
+ 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;