diff options
author | Piotr Dziwinski <piotrdz@gmail.com> | 2012-07-04 19:20:22 +0200 |
---|---|---|
committer | Piotr Dziwinski <piotrdz@gmail.com> | 2012-07-04 19:20:22 +0200 |
commit | 092e4ae75e28fca8cf13d0315eb3923ba1c27133 (patch) | |
tree | 626db24b153b1ef43486a50361fde4dd046dc2ad | |
parent | 398186afd0f4f18ccdcffe8b7eb37f1873c28e61 (diff) | |
download | colobot-092e4ae75e28fca8cf13d0315eb3923ba1c27133.tar.gz colobot-092e4ae75e28fca8cf13d0315eb3923ba1c27133.tar.bz2 colobot-092e4ae75e28fca8cf13d0315eb3923ba1c27133.zip |
Enabled logging & minor fixes
- added logger to main()
- removed reference to Snd namespace and renamed back to sound.h
- fixed minor issues
-rw-r--r-- | src/CMakeLists.txt | 3 | ||||
-rw-r--r-- | src/app/app.cpp | 5 | ||||
-rw-r--r-- | src/app/app.h | 3 | ||||
-rw-r--r-- | src/app/main.cpp | 19 | ||||
-rw-r--r-- | src/common/singleton.h | 4 | ||||
-rw-r--r-- | src/plugins/plugin.h | 10 | ||||
-rw-r--r-- | src/sound/sound.h (renamed from src/sound/soundinterface.h) | 0 |
7 files changed, 34 insertions, 10 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1be7a59..03bb03c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -30,6 +30,7 @@ app/app.cpp app/main.cpp app/system.cpp common/event.cpp +common/logger.cpp common/iman.cpp # common/metafile.cpp # common/misc.cpp @@ -117,7 +118,7 @@ graphics/opengl/glengine.cpp # script/cbottoken.cpp # script/cmdtoken.cpp # script/script.cpp -sound/sound.cpp +# sound/sound.cpp # ui/button.cpp # ui/check.cpp # ui/color.cpp 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; } + diff --git a/src/common/singleton.h b/src/common/singleton.h index 8e423c5..dc09645 100644 --- a/src/common/singleton.h +++ b/src/common/singleton.h @@ -39,7 +39,7 @@ template<typename T> class CSingleton } static bool IsCreated() { - return mInstance != nullptr; + return mInstance != NULL; } CSingleton() { @@ -48,7 +48,7 @@ template<typename T> class CSingleton } ~CSingleton() { - mInstance = nullptr; + mInstance = NULL; } private: diff --git a/src/plugins/plugin.h b/src/plugins/plugin.h index 216d08c..f238122 100644 --- a/src/plugins/plugin.h +++ b/src/plugins/plugin.h @@ -21,13 +21,13 @@ #define PLUGIN_INTERFACE(class_type, interface_type) \ - extern "C" interface_type* installPlugin() { return (interface_type *)new class_type(); } \ - extern "C" void uninstallPlugin(class_type *_class) { delete _class; } + extern "C" interface_type* installPlugin() { return (interface_type *)new class_type(); } \ + extern "C" void uninstallPlugin(class_type *_class) { delete _class; } class CPlugin { - public: - virtual char* pluginName() = 0; - virtual int pluginVersion() = 0; + public: + virtual char* PluginName() = 0; + virtual int PluginVersion() = 0; }; diff --git a/src/sound/soundinterface.h b/src/sound/sound.h index 598ffe3..598ffe3 100644 --- a/src/sound/soundinterface.h +++ b/src/sound/sound.h |