1
0
Conflicts:
	src/Server.cpp
This commit is contained in:
Tiger Wang
2014-08-29 14:56:40 +01:00
163 changed files with 5946 additions and 2375 deletions

View File

@@ -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)