summaryrefslogtreecommitdiffstats
path: root/src/Root.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-08-29 15:56:40 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-08-29 15:56:40 +0200
commit431b7ed0b7764db732e39802a40d94dfe9f2108b (patch)
treef3f5ab4a7b1f2838733004d8294e571b777e631f /src/Root.cpp
parentAdded new console command with cleanup (diff)
parentVanillaFluidSimulator: Fixed an invalid Y-coord query. (diff)
downloadcuberite-431b7ed0b7764db732e39802a40d94dfe9f2108b.tar
cuberite-431b7ed0b7764db732e39802a40d94dfe9f2108b.tar.gz
cuberite-431b7ed0b7764db732e39802a40d94dfe9f2108b.tar.bz2
cuberite-431b7ed0b7764db732e39802a40d94dfe9f2108b.tar.lz
cuberite-431b7ed0b7764db732e39802a40d94dfe9f2108b.tar.xz
cuberite-431b7ed0b7764db732e39802a40d94dfe9f2108b.tar.zst
cuberite-431b7ed0b7764db732e39802a40d94dfe9f2108b.zip
Diffstat (limited to 'src/Root.cpp')
-rw-r--r--src/Root.cpp43
1 files changed, 19 insertions, 24 deletions
diff --git a/src/Root.cpp b/src/Root.cpp
index f72f0bae3..f04cbf08b 100644
--- a/src/Root.cpp
+++ b/src/Root.cpp
@@ -6,7 +6,6 @@
#include "World.h"
#include "WebAdmin.h"
#include "FurnaceRecipe.h"
-#include "GroupManager.h"
#include "CraftingRecipes.h"
#include "Bindings/PluginManager.h"
#include "MonsterConfig.h"
@@ -18,6 +17,7 @@
#include "CommandOutput.h"
#include "DeadlockDetect.h"
#include "OSSupport/Timer.h"
+#include "LoggerListeners.h"
#include "inifile/iniFile.h"
@@ -46,12 +46,10 @@ cRoot::cRoot(void) :
m_InputThread(NULL),
m_Server(NULL),
m_MonsterConfig(NULL),
- m_GroupManager(NULL),
m_CraftingRecipes(NULL),
m_FurnaceRecipe(NULL),
m_WebAdmin(NULL),
m_PluginManager(NULL),
- m_Log(NULL),
m_bStop(false),
m_bRestart(false)
{
@@ -105,10 +103,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
+
+ cLogger::cListener * consoleLogListener = MakeConsoleListener();
+ cLogger::cListener * fileLogListener = new cFileListener();
+ cLogger::GetInstance().AttachListener(consoleLogListener);
+ cLogger::GetInstance().AttachListener(fileLogListener);
+
+ LOG("--- Started Log ---\n");
cDeadlockDetect dd;
- delete m_Log;
- m_Log = new cMCLogger();
m_bStop = false;
while (!m_bStop)
@@ -156,7 +159,7 @@ void cRoot::Start(void)
m_WebAdmin->Init();
LOGD("Loading settings...");
- m_GroupManager = new cGroupManager();
+ m_RankManager.Initialize(m_MojangAPI);
m_CraftingRecipes = new cCraftingRecipes;
m_FurnaceRecipe = new cFurnaceRecipe();
@@ -235,8 +238,6 @@ void cRoot::Start(void)
LOGD("Unloading recipes...");
delete m_FurnaceRecipe; m_FurnaceRecipe = NULL;
delete m_CraftingRecipes; m_CraftingRecipes = NULL;
- LOGD("Forgetting groups...");
- delete m_GroupManager; m_GroupManager = NULL;
LOGD("Unloading worlds...");
UnloadWorlds();
@@ -249,8 +250,13 @@ void cRoot::Start(void)
delete m_Server; m_Server = NULL;
LOG("Shutdown successful!");
}
-
- delete m_Log; m_Log = NULL;
+
+ LOG("--- Stopped Log ---");
+
+ cLogger::GetInstance().DetachListener(consoleLogListener);
+ delete consoleLogListener;
+ cLogger::GetInstance().DetachListener(fileLogListener);
+ delete fileLogListener;
}
@@ -274,15 +280,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)
@@ -537,17 +543,6 @@ void cRoot::SaveAllChunks(void)
-void cRoot::ReloadGroups(void)
-{
- LOG("Reload groups ...");
- m_GroupManager->LoadGroups();
- m_GroupManager->CheckUsers();
-}
-
-
-
-
-
void cRoot::BroadcastChat(const AString & a_Message, eMessageType a_ChatPrefix)
{
for (WorldMap::iterator itr = m_WorldsByName.begin(), end = m_WorldsByName.end(); itr != end; ++itr)