1
0

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
This commit is contained in:
madmaxoft@gmail.com
2012-02-01 22:38:03 +00:00
parent 28ff03fcfe
commit 48d30d6ab4
25 changed files with 702 additions and 324 deletions

View File

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