aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/World.cpp2
-rw-r--r--src/trinityrealm/AuthSocket.cpp17
-rw-r--r--src/trinityrealm/Main.cpp5
-rw-r--r--src/trinityrealm/RealmList.cpp2
-rw-r--r--src/trinityrealm/RealmList.h8
5 files changed, 18 insertions, 16 deletions
diff --git a/src/game/World.cpp b/src/game/World.cpp
index b06f02e90b5..69dda6638d8 100644
--- a/src/game/World.cpp
+++ b/src/game/World.cpp
@@ -1711,7 +1711,7 @@ void World::SetInitialWorldSettings()
void World::DetectDBCLang()
{
- uint8 m_lang_confid = sConfig.GetIntDefault("DBC.Locale", 255);
+ uint16 m_lang_confid = sConfig.GetIntDefault("DBC.Locale", 255);
if (m_lang_confid != 255 && m_lang_confid >= MAX_LOCALE)
{
diff --git a/src/trinityrealm/AuthSocket.cpp b/src/trinityrealm/AuthSocket.cpp
index 6f4f9670514..d8582eb4beb 100644
--- a/src/trinityrealm/AuthSocket.cpp
+++ b/src/trinityrealm/AuthSocket.cpp
@@ -34,8 +34,6 @@
#include "Auth/Sha1.h"
//#include "Util.h" -- for commented utf8ToUpperOnlyLatin
-extern RealmList m_realmList;
-
extern DatabaseType loginDatabase;
#define ChunkSize 2048
@@ -816,21 +814,20 @@ bool AuthSocket::_HandleRealmList()
std::string rI = (*result)[1].GetCppString();
///- Update realm list if need
- m_realmList.UpdateIfNeed();
+ sRealmList->UpdateIfNeed();
RealmList::RealmMap::const_iterator rlm;
- RealmList built_realmList;
- for (rlm = m_realmList.begin(); rlm != m_realmList.end(); ++rlm)
+ for (rlm = sRealmList->begin(); rlm != sRealmList->end(); ++rlm)
{
if ( _expversion & POST_BC_EXP_FLAG )//2.4.3 and 3.1.3 cliens
{
if (rlm->second.gamebuild == _build)
- built_realmList.AddRealm(rlm->second);
+ sRealmList->AddRealm(rlm->second);
}
else if ( _expversion & PRE_BC_EXP_FLAG )//1.12.1 and 1.12.2 clients are compatible with eachother
{
if ( AuthHelper::IsPreBCAcceptedClientBuild ( rlm->second.gamebuild ) )
- built_realmList.AddRealm(rlm->second);
+ sRealmList->AddRealm(rlm->second);
}
}
@@ -839,12 +836,12 @@ bool AuthSocket::_HandleRealmList()
ByteBuffer pkt;
pkt << (uint32) 0;
if ( _expversion & POST_BC_EXP_FLAG )//only 2.4.3 and 3.1.3 cliens
- pkt << (uint16) built_realmList.size();
+ pkt << (uint16) sRealmList->size();
else
- pkt << (uint32) built_realmList.size();
+ pkt << (uint32) sRealmList->size();
RealmList::RealmMap::const_iterator i;
- for (i = built_realmList.begin(); i != built_realmList.end(); ++i)
+ for (i = sRealmList->begin(); i != sRealmList->end(); ++i)
{
uint8 AmountOfCharacters;
diff --git a/src/trinityrealm/Main.cpp b/src/trinityrealm/Main.cpp
index aba65e06c9a..c023e84b5b4 100644
--- a/src/trinityrealm/Main.cpp
+++ b/src/trinityrealm/Main.cpp
@@ -61,7 +61,6 @@ void UnhookSignals();
void HookSignals();
bool stopEvent = false; ///< Setting it to true stops the server
-RealmList m_realmList; ///< Holds the list of realms for this server
DatabaseType loginDatabase; ///< Accessor to the realm server database
@@ -194,8 +193,8 @@ extern int main(int argc, char **argv)
}
///- Get the list of realms for the server
- m_realmList.Initialize(sConfig.GetIntDefault("RealmsStateUpdateDelay", 20));
- if (m_realmList.size() == 0)
+ sRealmList->Initialize(sConfig.GetIntDefault("RealmsStateUpdateDelay", 20));
+ if (sRealmList->size() == 0)
{
sLog.outError("No valid realms specified.");
return 1;
diff --git a/src/trinityrealm/RealmList.cpp b/src/trinityrealm/RealmList.cpp
index 5a441de8012..2591fe02359 100644
--- a/src/trinityrealm/RealmList.cpp
+++ b/src/trinityrealm/RealmList.cpp
@@ -24,10 +24,8 @@
#include "Common.h"
#include "RealmList.h"
-#include "Policies/SingletonImp.h"
#include "Database/DatabaseEnv.h"
-INSTANTIATE_SINGLETON_1(RealmList);
extern DatabaseType loginDatabase;
diff --git a/src/trinityrealm/RealmList.h b/src/trinityrealm/RealmList.h
index be0ff0c2351..b29b561c797 100644
--- a/src/trinityrealm/RealmList.h
+++ b/src/trinityrealm/RealmList.h
@@ -25,6 +25,8 @@
#ifndef _REALMLIST_H
#define _REALMLIST_H
+#include <ace/Singleton.h>
+#include <ace/Null_Mutex.h>
#include "Common.h"
/// Storage object for a realm
@@ -45,6 +47,9 @@ struct Realm
class RealmList
{
public:
+ // Null_Mutex is safe because the singleton initialized before the acceptor initialized(another place where the singleton called)
+ static RealmList* instance() { return ACE_Singleton<RealmList, ACE_Null_Mutex>::instance(); }
+
typedef std::map<std::string, Realm> RealmMap;
RealmList();
@@ -67,5 +72,8 @@ class RealmList
uint32 m_UpdateInterval;
time_t m_NextUpdateTime;
};
+
+#define sRealmList RealmList::instance()
+
#endif
/// @}