Merge branch 'origin/LoadWorlds/cAuthenticatorINI'
This commit is contained in:
commit
f032a2ff74
@ -28,7 +28,6 @@ cAuthenticator::cAuthenticator(void) :
|
|||||||
m_Address(DEFAULT_AUTH_ADDRESS),
|
m_Address(DEFAULT_AUTH_ADDRESS),
|
||||||
m_ShouldAuthenticate(true)
|
m_ShouldAuthenticate(true)
|
||||||
{
|
{
|
||||||
ReadINI();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -45,14 +44,8 @@ cAuthenticator::~cAuthenticator()
|
|||||||
|
|
||||||
|
|
||||||
/// Read custom values from INI
|
/// Read custom values from INI
|
||||||
void cAuthenticator::ReadINI(void)
|
void cAuthenticator::ReadINI(cIniFile & IniFile)
|
||||||
{
|
{
|
||||||
cIniFile IniFile;
|
|
||||||
if (!IniFile.ReadFile("settings.ini"))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_Server = IniFile.GetValue("Authentication", "Server");
|
m_Server = IniFile.GetValue("Authentication", "Server");
|
||||||
m_Address = IniFile.GetValue("Authentication", "Address");
|
m_Address = IniFile.GetValue("Authentication", "Address");
|
||||||
m_ShouldAuthenticate = IniFile.GetValueB("Authentication", "Authenticate", true);
|
m_ShouldAuthenticate = IniFile.GetValueB("Authentication", "Authenticate", true);
|
||||||
@ -100,8 +93,9 @@ void cAuthenticator::Authenticate(int a_ClientID, const AString & a_UserName, co
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cAuthenticator::Start(void)
|
void cAuthenticator::Start(cIniFile & IniFile)
|
||||||
{
|
{
|
||||||
|
ReadINI(IniFile);
|
||||||
m_ShouldTerminate = false;
|
m_ShouldTerminate = false;
|
||||||
super::Start();
|
super::Start();
|
||||||
}
|
}
|
||||||
|
@ -37,13 +37,13 @@ public:
|
|||||||
~cAuthenticator();
|
~cAuthenticator();
|
||||||
|
|
||||||
/// (Re-)read server and address from INI:
|
/// (Re-)read server and address from INI:
|
||||||
void ReadINI(void);
|
void ReadINI(cIniFile & IniFile);
|
||||||
|
|
||||||
/// Queues a request for authenticating a user. If the auth fails, the user is kicked
|
/// Queues a request for authenticating a user. If the auth fails, the user is kicked
|
||||||
void Authenticate(int a_ClientID, const AString & a_UserName, const AString & a_ServerHash);
|
void Authenticate(int a_ClientID, const AString & a_UserName, const AString & a_ServerHash);
|
||||||
|
|
||||||
/// Starts the authenticator thread. The thread may be started and stopped repeatedly
|
/// Starts the authenticator thread. The thread may be started and stopped repeatedly
|
||||||
void Start(void);
|
void Start(cIniFile & IniFile);
|
||||||
|
|
||||||
/// Stops the authenticator thread. The thread may be started and stopped repeatedly
|
/// Stops the authenticator thread. The thread may be started and stopped repeatedly
|
||||||
void Stop(void);
|
void Stop(void);
|
||||||
|
@ -149,7 +149,7 @@ void cRoot::Start(void)
|
|||||||
m_FurnaceRecipe = new cFurnaceRecipe();
|
m_FurnaceRecipe = new cFurnaceRecipe();
|
||||||
|
|
||||||
LOGD("Loading worlds...");
|
LOGD("Loading worlds...");
|
||||||
LoadWorlds();
|
LoadWorlds(IniFile);
|
||||||
|
|
||||||
LOGD("Loading plugin manager...");
|
LOGD("Loading plugin manager...");
|
||||||
m_PluginManager = new cPluginManager();
|
m_PluginManager = new cPluginManager();
|
||||||
@ -160,7 +160,7 @@ void cRoot::Start(void)
|
|||||||
|
|
||||||
// This sets stuff in motion
|
// This sets stuff in motion
|
||||||
LOGD("Starting Authenticator...");
|
LOGD("Starting Authenticator...");
|
||||||
m_Authenticator.Start();
|
m_Authenticator.Start(IniFile);
|
||||||
|
|
||||||
LOGD("Starting worlds...");
|
LOGD("Starting worlds...");
|
||||||
StartWorlds();
|
StartWorlds();
|
||||||
@ -245,11 +245,8 @@ void cRoot::LoadGlobalSettings()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cRoot::LoadWorlds(void)
|
void cRoot::LoadWorlds(cIniFile & IniFile)
|
||||||
{
|
{
|
||||||
cIniFile IniFile;
|
|
||||||
IniFile.ReadFile("settings.ini"); // Doesn't matter if success or not
|
|
||||||
|
|
||||||
// First get the default world
|
// First get the default world
|
||||||
AString DefaultWorldName = IniFile.GetValueSet("Worlds", "DefaultWorld", "world");
|
AString DefaultWorldName = IniFile.GetValueSet("Worlds", "DefaultWorld", "world");
|
||||||
m_pDefaultWorld = new cWorld( DefaultWorldName.c_str() );
|
m_pDefaultWorld = new cWorld( DefaultWorldName.c_str() );
|
||||||
|
@ -162,7 +162,7 @@ private:
|
|||||||
void LoadGlobalSettings();
|
void LoadGlobalSettings();
|
||||||
|
|
||||||
/// Loads the worlds from settings.ini, creates the worldmap
|
/// Loads the worlds from settings.ini, creates the worldmap
|
||||||
void LoadWorlds(void);
|
void LoadWorlds(cIniFile & IniFile);
|
||||||
|
|
||||||
/// Starts each world's life
|
/// Starts each world's life
|
||||||
void StartWorlds(void);
|
void StartWorlds(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user