From 48d30d6ab4657e00c0c861d67285256daeff1142 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Wed, 1 Feb 2012 22:38:03 +0000 Subject: Rewritten cAuthenticator to make use of the new cIsThread architecture - now authentication runs in a single separate thread for all clients; Global player-kicking function (cServer, cRoot); More char * -> AString conversion git-svn-id: http://mc-server.googlecode.com/svn/trunk@221 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cRoot.cpp | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 67 insertions(+), 1 deletion(-) (limited to 'source/cRoot.cpp') diff --git a/source/cRoot.cpp b/source/cRoot.cpp index 73f5a6397..0ccee5f20 100644 --- a/source/cRoot.cpp +++ b/source/cRoot.cpp @@ -31,6 +31,10 @@ struct cRoot::sRootState WorldMap WorldsByName; }; + + + + cRoot::cRoot() : m_Server( 0 ) , m_MonsterConfig( 0 ) @@ -48,12 +52,20 @@ cRoot::cRoot() s_Root = this; } + + + + cRoot::~cRoot() { s_Root = 0; delete m_pState; } + + + + void cRoot::InputThread(void* a_Params) { cRoot& self = *(cRoot*)a_Params; @@ -66,6 +78,10 @@ void cRoot::InputThread(void* a_Params) } } + + + + void cRoot::Start() { if( m_Log ) delete m_Log, m_Log = 0; @@ -88,7 +104,6 @@ void cRoot::Start() return; } - cIniFile WebIniFile("webadmin.ini"); if( WebIniFile.ReadFile() ) { @@ -108,6 +123,7 @@ void cRoot::Start() m_MonsterConfig = new cMonsterConfig(2); // This sets stuff in motion + m_Authenticator.Start(); m_Server->StartListenThread(); //cHeartBeat* HeartBeat = new cHeartBeat(); @@ -137,6 +153,10 @@ void cRoot::Start() delete m_Log; m_Log = 0; } + + + + void cRoot::LoadWorlds() { cIniFile IniFile("settings.ini"); IniFile.ReadFile(); @@ -169,6 +189,10 @@ void cRoot::LoadWorlds() } } + + + + void cRoot::UnloadWorlds() { for( WorldMap::iterator itr = m_pState->WorldsByName.begin(); itr != m_pState->WorldsByName.end(); ++itr ) @@ -178,16 +202,28 @@ void cRoot::UnloadWorlds() m_pState->WorldsByName.clear(); } + + + + cWorld* cRoot::GetWorld() { return GetDefaultWorld(); } + + + + cWorld* cRoot::GetDefaultWorld() { return m_pState->pDefaultWorld; } + + + + cWorld* cRoot::GetWorld( const char* a_WorldName ) { WorldMap::iterator itr = m_pState->WorldsByName.find( a_WorldName ); @@ -196,6 +232,10 @@ cWorld* cRoot::GetWorld( const char* a_WorldName ) return 0; } + + + + void cRoot::TickWorlds( float a_Dt ) { for( WorldMap::iterator itr = m_pState->WorldsByName.begin(); itr != m_pState->WorldsByName.end(); ++itr ) @@ -204,6 +244,10 @@ void cRoot::TickWorlds( float a_Dt ) } } + + + + void cRoot::ServerCommand( const char* a_Cmd ) { //LOG("Command: %s", a_Cmd ); @@ -217,3 +261,25 @@ void cRoot::ServerCommand( const char* a_Cmd ) m_bRestart = true; } } + + + + + +void cRoot::KickUser(const AString & iUserName, const AString & iReason) +{ + m_Server->KickUser(iUserName, iReason); +} + + + + + +void cRoot::AuthenticateUser(const AString & iUserName) +{ + m_Server->AuthenticateUser(iUserName); +} + + + + -- cgit v1.2.3