Replace useless code with more useful code.
--HG-- branch : trunk
This commit is contained in:
@@ -27,11 +27,11 @@
|
||||
#include "Policies/SingletonImp.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
|
||||
INSTANTIATE_SINGLETON_1( RealmList );
|
||||
INSTANTIATE_SINGLETON_1(RealmList);
|
||||
|
||||
extern DatabaseType loginDatabase;
|
||||
|
||||
RealmList::RealmList( ) : m_UpdateInterval(0), m_NextUpdateTime(time(NULL))
|
||||
RealmList::RealmList() : m_UpdateInterval(0), m_NextUpdateTime(time(NULL))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ void RealmList::Initialize(uint32 updateInterval)
|
||||
UpdateRealms(true);
|
||||
}
|
||||
|
||||
void RealmList::UpdateRealm( uint32 ID, const std::string& name, const std::string& address, uint32 port, uint8 icon, uint8 color, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, uint32 build)
|
||||
void RealmList::UpdateRealm(uint32 ID, const std::string& name, const std::string& address, uint32 port, uint8 icon, uint8 color, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, uint32 build)
|
||||
{
|
||||
///- Create new if not exist or update existed
|
||||
Realm& realm = m_realms[name];
|
||||
@@ -67,7 +67,7 @@ void RealmList::UpdateRealm( uint32 ID, const std::string& name, const std::stri
|
||||
void RealmList::UpdateIfNeed()
|
||||
{
|
||||
// maybe disabled or updated recently
|
||||
if(!m_UpdateInterval || m_NextUpdateTime > time(NULL))
|
||||
if (!m_UpdateInterval || m_NextUpdateTime > time(NULL))
|
||||
return;
|
||||
|
||||
m_NextUpdateTime = time(NULL) + m_UpdateInterval;
|
||||
@@ -83,10 +83,10 @@ void RealmList::UpdateRealms(bool init)
|
||||
{
|
||||
sLog.outDetail("Updating Realm List...");
|
||||
|
||||
QueryResult *result = loginDatabase.Query( "SELECT id, name, address, port, icon, color, timezone, allowedSecurityLevel, population, gamebuild FROM realmlist WHERE color <> 3 ORDER BY name" );
|
||||
QueryResult *result = loginDatabase.Query("SELECT id, name, address, port, icon, color, timezone, allowedSecurityLevel, population, gamebuild FROM realmlist WHERE color <> 3 ORDER BY name");
|
||||
|
||||
///- Circle through results and add them to the realm map
|
||||
if(result)
|
||||
if (result)
|
||||
{
|
||||
do
|
||||
{
|
||||
@@ -94,10 +94,10 @@ void RealmList::UpdateRealms(bool init)
|
||||
|
||||
uint8 allowedSecurityLevel = fields[7].GetUInt8();
|
||||
|
||||
UpdateRealm(fields[0].GetUInt32(), fields[1].GetCppString(),fields[2].GetCppString(),fields[3].GetUInt32(),fields[4].GetUInt8(), fields[5].GetUInt8(), fields[6].GetUInt8(), (allowedSecurityLevel <= SEC_ADMINISTRATOR ? AccountTypes(allowedSecurityLevel) : SEC_ADMINISTRATOR), fields[8].GetFloat(), fields[9].GetUInt32() );
|
||||
if(init)
|
||||
UpdateRealm(fields[0].GetUInt32(), fields[1].GetCppString(),fields[2].GetCppString(),fields[3].GetUInt32(),fields[4].GetUInt8(), fields[5].GetUInt8(), fields[6].GetUInt8(), (allowedSecurityLevel <= SEC_ADMINISTRATOR ? AccountTypes(allowedSecurityLevel) : SEC_ADMINISTRATOR), fields[8].GetFloat(), fields[9].GetUInt32());
|
||||
if (init)
|
||||
sLog.outString("Added realm \"%s\".", fields[1].GetString());
|
||||
} while( result->NextRow() );
|
||||
} while(result->NextRow());
|
||||
delete result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user