diff options
| author | silinoron <none@none> | 2010-12-27 09:02:02 -0800 |
|---|---|---|
| committer | silinoron <none@none> | 2010-12-27 09:02:02 -0800 |
| commit | 60c6d462e4b1c2c43fe1e8ba47a962ef5e4dc6aa (patch) | |
| tree | e047e4dfbcfdca26deaaac431d32d183e4e363ae /src/server/authserver/Realms | |
| parent | dd745ef3264aa7a63a4bfaf0bb755aa3b410e7fe (diff) | |
Core/Authserver: Significant cleanup in preparation for a rewrite.
Dropped support for running as a service on windows; it may be back in some form later.
Otherwise there should be no functional changes.
--HG--
branch : trunk
Diffstat (limited to 'src/server/authserver/Realms')
| -rwxr-xr-x | src/server/authserver/Realms/RealmList.cpp | 38 | ||||
| -rwxr-xr-x | src/server/authserver/Realms/RealmList.h | 41 |
2 files changed, 34 insertions, 45 deletions
diff --git a/src/server/authserver/Realms/RealmList.cpp b/src/server/authserver/Realms/RealmList.cpp index 608657c844e..5284e2bd7fc 100755 --- a/src/server/authserver/Realms/RealmList.cpp +++ b/src/server/authserver/Realms/RealmList.cpp @@ -16,44 +16,38 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -/** \file - \ingroup realmd -*/ - #include "Common.h" #include "RealmList.h" #include "Database/DatabaseEnv.h" -RealmList::RealmList() : m_UpdateInterval(0), m_NextUpdateTime(time(NULL)) -{ -} +RealmList::RealmList() : m_UpdateInterval(0), m_NextUpdateTime(time(NULL)) { } -/// Load the realm list from the database +// Load the realm list from the database void RealmList::Initialize(uint32 updateInterval) { m_UpdateInterval = updateInterval; - ///- Get the content of the realmlist table in the database + // Get the content of the realmlist table in the database 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) { - ///- Create new if not exist or update existed + // Create new if not exist or update existed Realm& realm = m_realms[name]; - realm.m_ID = ID; - realm.name = name; - realm.icon = icon; - realm.color = color; - realm.timezone = timezone; + realm.m_ID = ID; + realm.name = name; + realm.icon = icon; + realm.color = color; + realm.timezone = timezone; realm.allowedSecurityLevel = allowedSecurityLevel; - realm.populationLevel = popu; + realm.populationLevel = popu; - ///- Append port to IP address. + // Append port to IP address. std::ostringstream ss; ss << address << ":" << port; - realm.address = ss.str(); + realm.address = ss.str(); realm.gamebuild = build; } @@ -69,22 +63,22 @@ void RealmList::UpdateIfNeed() m_realms.clear(); // Get the content of the realmlist table in the database - UpdateRealms(false); + UpdateRealms(); } void RealmList::UpdateRealms(bool init) { sLog->outDetail("Updating Realm List..."); - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_REALMLIST); + PreparedStatement *stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_REALMLIST); PreparedQueryResult result = LoginDatabase.Query(stmt); - ///- Circle through results and add them to the realm map + // Circle through results and add them to the realm map if (result) { do { - Field* fields = result->Fetch(); + Field *fields = result->Fetch(); uint32 realmId = fields[0].GetUInt32(); const std::string& name = fields[1].GetString(); const std::string& address = fields[2].GetString(); diff --git a/src/server/authserver/Realms/RealmList.h b/src/server/authserver/Realms/RealmList.h index c5877aa9d61..33eb8948a2b 100755 --- a/src/server/authserver/Realms/RealmList.h +++ b/src/server/authserver/Realms/RealmList.h @@ -16,10 +16,6 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -/// \addtogroup realmd -/// @{ -/// \file - #ifndef _REALMLIST_H #define _REALMLIST_H @@ -27,7 +23,7 @@ #include <ace/Null_Mutex.h> #include "Common.h" -/// Storage object for a realm +// Storage object for a realm struct Realm { std::string address; @@ -44,31 +40,30 @@ struct Realm /// Storage object for the list of realms on the server class RealmList { - public: - typedef std::map<std::string, Realm> RealmMap; +public: + typedef std::map<std::string, Realm> RealmMap; + + RealmList(); + ~RealmList() {} - RealmList(); - ~RealmList() {} + void Initialize(uint32 updateInterval); - void Initialize(uint32 updateInterval); + void UpdateIfNeed(); - void UpdateIfNeed(); + void AddRealm(Realm NewRealm) {m_realms[NewRealm.name] = NewRealm;} - void AddRealm(Realm NewRealm) {m_realms[NewRealm.name] = NewRealm;} + RealmMap::const_iterator begin() const { return m_realms.begin(); } + RealmMap::const_iterator end() const { return m_realms.end(); } + uint32 size() const { return m_realms.size(); } - RealmMap::const_iterator begin() const { return m_realms.begin(); } - RealmMap::const_iterator end() const { return m_realms.end(); } - uint32 size() const { return m_realms.size(); } - private: - void UpdateRealms(bool init); - void 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); +private: + void UpdateRealms(bool init=false); + void 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); - RealmMap m_realms; ///< Internal map of realms - uint32 m_UpdateInterval; - time_t m_NextUpdateTime; + RealmMap m_realms; + uint32 m_UpdateInterval; + time_t m_NextUpdateTime; }; #define sRealmList ACE_Singleton<RealmList, ACE_Null_Mutex>::instance() - #endif -/// @} |
