mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[8793] Don't do operations through singleton if already in singleton context.
* Also, some minor things: - Remove duplicate sWorldLog define. - Add sRealmList macro for RealmList::Instance(). - Use sLog macro in scripting log functions.
This commit is contained in:
parent
146657885d
commit
b3f3ffa885
11 changed files with 32 additions and 32 deletions
|
|
@ -258,7 +258,7 @@ void InstanceSaveManager::CleanupInstances()
|
|||
bar.step();
|
||||
|
||||
// load reset times and clean expired instances
|
||||
sInstanceSaveMgr.LoadResetTimes();
|
||||
LoadResetTimes();
|
||||
|
||||
// clean character/group - instance binds with invalid group/characters
|
||||
_DelHelper(CharacterDatabase, "character_instance.guid, instance", "character_instance", "LEFT JOIN characters ON character_instance.guid = characters.guid WHERE characters.guid IS NULL");
|
||||
|
|
|
|||
|
|
@ -4099,7 +4099,7 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
|
|||
continue;
|
||||
}
|
||||
|
||||
// if(!sObjectMgr.GetMangosStringLocale(tmp.dataint)) will checked after db_script_string loading
|
||||
// if(!GetMangosStringLocale(tmp.dataint)) will checked after db_script_string loading
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -5111,11 +5111,11 @@ uint32 ObjectMgr::GetTaxiMountDisplayId( uint32 id, uint32 team, bool allowed_al
|
|||
if (!mount_info)
|
||||
return 0;
|
||||
|
||||
uint16 mount_id = sObjectMgr.ChooseDisplayId(team,mount_info);
|
||||
uint16 mount_id = ChooseDisplayId(team,mount_info);
|
||||
if (!mount_id)
|
||||
return 0;
|
||||
|
||||
CreatureModelInfo const *minfo = sObjectMgr.GetCreatureModelRandomGender(mount_id);
|
||||
CreatureModelInfo const *minfo = GetCreatureModelRandomGender(mount_id);
|
||||
if (minfo)
|
||||
mount_id = minfo->modelid;
|
||||
|
||||
|
|
|
|||
|
|
@ -2260,8 +2260,8 @@ void SpellMgr::LoadSpellScriptTarget()
|
|||
{
|
||||
if( spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT || spellInfo->EffectImplicitTargetA[j] != TARGET_SELF && spellInfo->EffectImplicitTargetB[j] == TARGET_SCRIPT )
|
||||
{
|
||||
SpellScriptTarget::const_iterator lower = sSpellMgr.GetBeginSpellScriptTarget(spellInfo->Id);
|
||||
SpellScriptTarget::const_iterator upper = sSpellMgr.GetEndSpellScriptTarget(spellInfo->Id);
|
||||
SpellScriptTarget::const_iterator lower = GetBeginSpellScriptTarget(spellInfo->Id);
|
||||
SpellScriptTarget::const_iterator upper = GetEndSpellScriptTarget(spellInfo->Id);
|
||||
if(lower==upper)
|
||||
{
|
||||
sLog.outErrorDb("Spell (ID: %u) has effect EffectImplicitTargetA/EffectImplicitTargetB = %u (TARGET_SCRIPT), but does not have record in `spell_script_target`",spellInfo->Id,TARGET_SCRIPT);
|
||||
|
|
@ -2849,7 +2849,7 @@ SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const *spell
|
|||
}
|
||||
|
||||
// DB base check (if non empty then must fit at least single for allow)
|
||||
SpellAreaMapBounds saBounds = sSpellMgr.GetSpellAreaMapBounds(spellInfo->Id);
|
||||
SpellAreaMapBounds saBounds = GetSpellAreaMapBounds(spellInfo->Id);
|
||||
if (saBounds.first != saBounds.second)
|
||||
{
|
||||
for(SpellAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ World::AddSession_ (WorldSession* s)
|
|||
s->SendAddonsInfo();
|
||||
|
||||
WorldPacket pkt(SMSG_CLIENTCACHE_VERSION, 4);
|
||||
pkt << uint32(sWorld.getConfig(CONFIG_CLIENTCACHE_VERSION));
|
||||
pkt << uint32(getConfig(CONFIG_CLIENTCACHE_VERSION));
|
||||
s->SendPacket(&pkt);
|
||||
|
||||
s->SendAccountDataTimes(GLOBAL_CACHE_MASK);
|
||||
|
|
@ -329,7 +329,7 @@ bool World::RemoveQueuedPlayer(WorldSession* sess)
|
|||
pop_sess->SendAddonsInfo();
|
||||
|
||||
WorldPacket pkt(SMSG_CLIENTCACHE_VERSION, 4);
|
||||
pkt << uint32(sWorld.getConfig(CONFIG_CLIENTCACHE_VERSION));
|
||||
pkt << uint32(getConfig(CONFIG_CLIENTCACHE_VERSION));
|
||||
pop_sess->SendPacket(&pkt);
|
||||
|
||||
pop_sess->SendAccountDataTimes(GLOBAL_CACHE_MASK);
|
||||
|
|
@ -1016,10 +1016,10 @@ void World::LoadConfigSettings(bool reload)
|
|||
|
||||
//visibility on continents
|
||||
m_MaxVisibleDistanceOnContinents = sConfig.GetFloatDefault("Visibility.Distance.Continents", DEFAULT_VISIBILITY_DISTANCE);
|
||||
if(m_MaxVisibleDistanceOnContinents < 45*sWorld.getRate(RATE_CREATURE_AGGRO))
|
||||
if(m_MaxVisibleDistanceOnContinents < 45*getRate(RATE_CREATURE_AGGRO))
|
||||
{
|
||||
sLog.outError("Visibility.Distance.Continents can't be less max aggro radius %f", 45*sWorld.getRate(RATE_CREATURE_AGGRO));
|
||||
m_MaxVisibleDistanceOnContinents = 45*sWorld.getRate(RATE_CREATURE_AGGRO);
|
||||
sLog.outError("Visibility.Distance.Continents can't be less max aggro radius %f", 45*getRate(RATE_CREATURE_AGGRO));
|
||||
m_MaxVisibleDistanceOnContinents = 45*getRate(RATE_CREATURE_AGGRO);
|
||||
}
|
||||
else if(m_MaxVisibleDistanceOnContinents + m_VisibleUnitGreyDistance > MAX_VISIBILITY_DISTANCE)
|
||||
{
|
||||
|
|
@ -1029,10 +1029,10 @@ void World::LoadConfigSettings(bool reload)
|
|||
|
||||
//visibility in instances
|
||||
m_MaxVisibleDistanceInInctances = sConfig.GetFloatDefault("Visibility.Distance.Instances", DEFAULT_VISIBILITY_INSTANCE);
|
||||
if(m_MaxVisibleDistanceInInctances < 45*sWorld.getRate(RATE_CREATURE_AGGRO))
|
||||
if(m_MaxVisibleDistanceInInctances < 45*getRate(RATE_CREATURE_AGGRO))
|
||||
{
|
||||
sLog.outError("Visibility.Distance.Instances can't be less max aggro radius %f",45*sWorld.getRate(RATE_CREATURE_AGGRO));
|
||||
m_MaxVisibleDistanceInInctances = 45*sWorld.getRate(RATE_CREATURE_AGGRO);
|
||||
sLog.outError("Visibility.Distance.Instances can't be less max aggro radius %f",45*getRate(RATE_CREATURE_AGGRO));
|
||||
m_MaxVisibleDistanceInInctances = 45*getRate(RATE_CREATURE_AGGRO);
|
||||
}
|
||||
else if(m_MaxVisibleDistanceInInctances + m_VisibleUnitGreyDistance > MAX_VISIBILITY_DISTANCE)
|
||||
{
|
||||
|
|
@ -1042,10 +1042,10 @@ void World::LoadConfigSettings(bool reload)
|
|||
|
||||
//visibility in BG/Arenas
|
||||
m_MaxVisibleDistanceInBGArenas = sConfig.GetFloatDefault("Visibility.Distance.BGArenas", DEFAULT_VISIBILITY_BGARENAS);
|
||||
if(m_MaxVisibleDistanceInBGArenas < 45*sWorld.getRate(RATE_CREATURE_AGGRO))
|
||||
if(m_MaxVisibleDistanceInBGArenas < 45*getRate(RATE_CREATURE_AGGRO))
|
||||
{
|
||||
sLog.outError("Visibility.Distance.BGArenas can't be less max aggro radius %f",45*sWorld.getRate(RATE_CREATURE_AGGRO));
|
||||
m_MaxVisibleDistanceInBGArenas = 45*sWorld.getRate(RATE_CREATURE_AGGRO);
|
||||
sLog.outError("Visibility.Distance.BGArenas can't be less max aggro radius %f",45*getRate(RATE_CREATURE_AGGRO));
|
||||
m_MaxVisibleDistanceInBGArenas = 45*getRate(RATE_CREATURE_AGGRO);
|
||||
}
|
||||
else if(m_MaxVisibleDistanceInBGArenas + m_VisibleUnitGreyDistance > MAX_VISIBILITY_DISTANCE)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -45,5 +45,3 @@ void WorldLog::Initialize()
|
|||
i_file = fopen((logsDir+logname).c_str(), "w");
|
||||
}
|
||||
}
|
||||
|
||||
#define sWorldLog WorldLog::Instance()
|
||||
|
|
|
|||
|
|
@ -879,14 +879,14 @@ bool AuthSocket::_HandleRealmList()
|
|||
delete result;
|
||||
|
||||
///- Update realm list if need
|
||||
RealmList::Instance().UpdateIfNeed();
|
||||
sRealmList.UpdateIfNeed();
|
||||
|
||||
///- Circle through realms in the RealmList and construct the return packet (including # of user characters in each realm)
|
||||
ByteBuffer pkt;
|
||||
pkt << (uint32) 0;
|
||||
pkt << (uint16) RealmList::Instance().size();
|
||||
pkt << (uint16) sRealmList.size();
|
||||
RealmList::RealmMap::const_iterator i;
|
||||
for( i = RealmList::Instance().begin(); i != RealmList::Instance().end(); ++i )
|
||||
for( i = sRealmList.begin(); i != sRealmList.end(); ++i )
|
||||
{
|
||||
uint8 AmountOfCharacters;
|
||||
|
||||
|
|
|
|||
|
|
@ -190,8 +190,8 @@ extern int main(int argc, char **argv)
|
|||
return 1;
|
||||
|
||||
///- Get the list of realms for the server
|
||||
RealmList::Instance().Initialize(sConfig.GetIntDefault("RealmsStateUpdateDelay", 20));
|
||||
if (RealmList::Instance().size() == 0)
|
||||
sRealmList.Initialize(sConfig.GetIntDefault("RealmsStateUpdateDelay", 20));
|
||||
if (sRealmList.size() == 0)
|
||||
{
|
||||
sLog.outError("No valid realms specified.");
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ RealmList::RealmList( ) : m_UpdateInterval(0), m_NextUpdateTime(time(NULL))
|
|||
{
|
||||
}
|
||||
|
||||
RealmList& RealmList::Instance()
|
||||
RealmList& sRealmList
|
||||
{
|
||||
static RealmList realmlist;
|
||||
return realmlist;
|
||||
|
|
|
|||
|
|
@ -64,5 +64,7 @@ class RealmList
|
|||
time_t m_NextUpdateTime;
|
||||
};
|
||||
|
||||
#define sRealmList RealmList::Instance()
|
||||
|
||||
#endif
|
||||
/// @}
|
||||
|
|
|
|||
|
|
@ -767,7 +767,7 @@ void outstring_log(const char * str, ...)
|
|||
vsnprintf(buf,256, str, ap);
|
||||
va_end(ap);
|
||||
|
||||
MaNGOS::Singleton<Log>::Instance().outString(buf);
|
||||
sLog.outString(buf);
|
||||
}
|
||||
|
||||
void detail_log(const char * str, ...)
|
||||
|
|
@ -781,7 +781,7 @@ void detail_log(const char * str, ...)
|
|||
vsnprintf(buf,256, str, ap);
|
||||
va_end(ap);
|
||||
|
||||
MaNGOS::Singleton<Log>::Instance().outDetail(buf);
|
||||
sLog.outDetail(buf);
|
||||
}
|
||||
|
||||
void debug_log(const char * str, ...)
|
||||
|
|
@ -795,7 +795,7 @@ void debug_log(const char * str, ...)
|
|||
vsnprintf(buf,256, str, ap);
|
||||
va_end(ap);
|
||||
|
||||
MaNGOS::Singleton<Log>::Instance().outDebug(buf);
|
||||
sLog.outDebug(buf);
|
||||
}
|
||||
|
||||
void error_log(const char * str, ...)
|
||||
|
|
@ -809,7 +809,7 @@ void error_log(const char * str, ...)
|
|||
vsnprintf(buf,256, str, ap);
|
||||
va_end(ap);
|
||||
|
||||
MaNGOS::Singleton<Log>::Instance().outError(buf);
|
||||
sLog.outError(buf);
|
||||
}
|
||||
|
||||
void error_db_log(const char * str, ...)
|
||||
|
|
@ -823,5 +823,5 @@ void error_db_log(const char * str, ...)
|
|||
vsnprintf(buf,256, str, ap);
|
||||
va_end(ap);
|
||||
|
||||
MaNGOS::Singleton<Log>::Instance().outErrorDb(buf);
|
||||
sLog.outErrorDb(buf);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "8792"
|
||||
#define REVISION_NR "8793"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue