[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:
XTZGZoReX 2009-11-08 19:32:50 +01:00
parent 146657885d
commit b3f3ffa885
11 changed files with 32 additions and 32 deletions

View file

@ -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");

View file

@ -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;

View file

@ -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)

View file

@ -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)
{

View file

@ -45,5 +45,3 @@ void WorldLog::Initialize()
i_file = fopen((logsDir+logname).c_str(), "w");
}
}
#define sWorldLog WorldLog::Instance()