summaryrefslogtreecommitdiffstats
path: root/src/app
diff options
context:
space:
mode:
Diffstat (limited to 'src/app')
-rw-r--r--src/app/app.cpp5
-rw-r--r--src/app/app.h3
-rw-r--r--src/app/main.cpp19
3 files changed, 25 insertions, 2 deletions
diff --git a/src/app/app.cpp b/src/app/app.cpp
index 4005707..68131fc 100644
--- a/src/app/app.cpp
+++ b/src/app/app.cpp
@@ -345,6 +345,11 @@ end:
return m_exitCode;
}
+int CApplication::GetExitCode()
+{
+ return m_exitCode;
+}
+
void CApplication::ParseEvent()
{
/* Event event;
diff --git a/src/app/app.h b/src/app/app.h
index e83652c..f776b10 100644
--- a/src/app/app.h
+++ b/src/app/app.h
@@ -60,6 +60,9 @@ public:
//! Main event loop
int Run();
+ //! Returns the code to be returned at main() exit
+ int GetExitCode();
+
protected:
//! Cleans up before exit
void Destroy();
diff --git a/src/app/main.cpp b/src/app/main.cpp
index 54d305e..151cd20 100644
--- a/src/app/main.cpp
+++ b/src/app/main.cpp
@@ -19,6 +19,7 @@
#include "app/app.h"
#include "app/system.h"
+#include "common/logger.h"
#include "common/misc.h"
#include "common/restext.h"
@@ -26,6 +27,10 @@
//! Entry point to the program
int main(int argc, char *argv[])
{
+ CLogger logger; // Create the logger
+
+ logger.Info("Colobot starting\n");
+
CApplication app; // single instance of the application
Error err = app.ParseArguments(argc, argv);
@@ -34,8 +39,18 @@ int main(int argc, char *argv[])
SystemDialog(SDT_ERROR, "COLOBOT", "Invalid commandline arguments!\n");
}
+ int code = 0;
+
if (! app.Create())
- return 0;
+ {
+ code = app.GetExitCode();
+ logger.Info("Didn't run main loop. Exiting with code %d\n", code);
+ return code;
+ }
+
+ code = app.Run();
- return app.Run();
+ logger.Info("Exiting with code %d\n", code);
+ return code;
}
+