summaryrefslogtreecommitdiffstats
path: root/src/Root.cpp
diff options
context:
space:
mode:
authorTycho <work.tycho+git@gmail.com>2014-08-10 20:34:11 +0200
committerTycho <work.tycho+git@gmail.com>2014-08-10 20:34:11 +0200
commit806d0936dc94f235858ffe1772a6215f86c5d000 (patch)
tree38a84d8de02dc7da20af969f88c722abbea13300 /src/Root.cpp
parentMerge pull request #1291 from mc-server/RedstoneCleanUp (diff)
downloadcuberite-806d0936dc94f235858ffe1772a6215f86c5d000.tar
cuberite-806d0936dc94f235858ffe1772a6215f86c5d000.tar.gz
cuberite-806d0936dc94f235858ffe1772a6215f86c5d000.tar.bz2
cuberite-806d0936dc94f235858ffe1772a6215f86c5d000.tar.lz
cuberite-806d0936dc94f235858ffe1772a6215f86c5d000.tar.xz
cuberite-806d0936dc94f235858ffe1772a6215f86c5d000.tar.zst
cuberite-806d0936dc94f235858ffe1772a6215f86c5d000.zip
Diffstat (limited to '')
-rw-r--r--src/Root.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/Root.cpp b/src/Root.cpp
index c20cf0d21..72048b631 100644
--- a/src/Root.cpp
+++ b/src/Root.cpp
@@ -18,6 +18,7 @@
#include "CommandOutput.h"
#include "DeadlockDetect.h"
#include "OSSupport/Timer.h"
+#include "Listeners.h"
#include "inifile/iniFile.h"
@@ -51,7 +52,6 @@ cRoot::cRoot(void) :
m_FurnaceRecipe(NULL),
m_WebAdmin(NULL),
m_PluginManager(NULL),
- m_Log(NULL),
m_bStop(false),
m_bRestart(false)
{
@@ -105,10 +105,15 @@ void cRoot::Start(void)
HMENU hmenu = GetSystemMenu(hwnd, FALSE);
EnableMenuItem(hmenu, SC_CLOSE, MF_GRAYED); // Disable close button when starting up; it causes problems with our CTRL-CLOSE handling
#endif
+
+ Logger::cLoggerListener * consoleLogListener = Logger::MakeConsoleListener();
+ Logger::cLoggerListener * fileLogListener = new Logger::cFileListener();
+ Logger::GetInstance().AttachListener(consoleLogListener);
+ Logger::GetInstance().AttachListener(fileLogListener);
+
+ LOG("--- Started Log ---\n");
cDeadlockDetect dd;
- delete m_Log;
- m_Log = new cMCLogger();
m_bStop = false;
while (!m_bStop)
@@ -249,8 +254,13 @@ void cRoot::Start(void)
delete m_Server; m_Server = NULL;
LOG("Shutdown successful!");
}
-
- delete m_Log; m_Log = NULL;
+
+ LOG("--- Stopped Log ---");
+
+ Logger::GetInstance().DetachListener(consoleLogListener);
+ delete consoleLogListener;
+ Logger::GetInstance().DetachListener(fileLogListener);
+ delete fileLogListener;
}
@@ -274,15 +284,15 @@ void cRoot::LoadWorlds(cIniFile & IniFile)
m_WorldsByName[ DefaultWorldName ] = m_pDefaultWorld;
// Then load the other worlds
- unsigned int KeyNum = IniFile.FindKey("Worlds");
- unsigned int NumWorlds = IniFile.GetNumValues(KeyNum);
+ int KeyNum = IniFile.FindKey("Worlds");
+ int NumWorlds = IniFile.GetNumValues(KeyNum);
if (NumWorlds <= 0)
{
return;
}
bool FoundAdditionalWorlds = false;
- for (unsigned int i = 0; i < NumWorlds; i++)
+ for (int i = 0; i < NumWorlds; i++)
{
AString ValueName = IniFile.GetValueName(KeyNum, i);
if (ValueName.compare("World") != 0)