Core/WorldRunnable: Convert autobroadcast to trinity standards (properly cache configs, change function name to better reflect purpose)
--HG-- branch : trunk
This commit is contained in:
@@ -1212,6 +1212,10 @@ void World::LoadConfigSettings(bool reload)
|
||||
// Dungeon finder
|
||||
m_bool_configs[CONFIG_DUNGEON_FINDER_ENABLE] = sConfig.GetBoolDefault("DungeonFinder.Enable", false);
|
||||
|
||||
// AutoBroadcast
|
||||
m_bool_configs[CONFIG_AUTOBROADCAST] = sConfig.GetBoolDefault("AutoBroadcast.On", false);
|
||||
m_int_configs[CONFIG_AUTOBROADCAST_CENTER] = sConfig.GetIntDefault("AutoBroadcast.Center", 0);
|
||||
|
||||
sScriptMgr.OnConfigLoad(reload);
|
||||
}
|
||||
|
||||
@@ -1930,15 +1934,13 @@ void World::Update(uint32 diff)
|
||||
///- Update objects when the timer has passed (maps, transport, creatures,...)
|
||||
sMapMgr.Update(diff); // As interval = 0
|
||||
|
||||
static uint32 autobroadcaston = 0;
|
||||
autobroadcaston = sConfig.GetIntDefault("AutoBroadcast.On", 0);
|
||||
if (autobroadcaston == 1)
|
||||
if (sWorld.getBoolConfig(CONFIG_AUTOBROADCAST))
|
||||
{
|
||||
if (m_timers[WUPDATE_AUTOBROADCAST].Passed())
|
||||
{
|
||||
m_timers[WUPDATE_AUTOBROADCAST].Reset();
|
||||
SendRNDBroadcast();
|
||||
}
|
||||
if (m_timers[WUPDATE_AUTOBROADCAST].Passed())
|
||||
{
|
||||
m_timers[WUPDATE_AUTOBROADCAST].Reset();
|
||||
SendAutoBroadcast();
|
||||
}
|
||||
}
|
||||
|
||||
sBattlegroundMgr.Update(diff);
|
||||
@@ -2440,7 +2442,7 @@ void World::ProcessCliCommands()
|
||||
}
|
||||
}
|
||||
|
||||
void World::SendRNDBroadcast()
|
||||
void World::SendAutoBroadcast()
|
||||
{
|
||||
if (m_Autobroadcasts.empty())
|
||||
return;
|
||||
@@ -2451,8 +2453,7 @@ void World::SendRNDBroadcast()
|
||||
std::advance(itr, rand() % m_Autobroadcasts.size());
|
||||
msg = *itr;
|
||||
|
||||
static uint32 abcenter = 0;
|
||||
abcenter = sConfig.GetIntDefault("AutoBroadcast.Center", 0);
|
||||
uint32 abcenter = sWorld.getIntConfig(CONFIG_AUTOBROADCAST_CENTER);
|
||||
if (abcenter == 0)
|
||||
{
|
||||
sWorld.SendWorldText(LANG_AUTO_BROADCAST, msg.c_str());
|
||||
|
||||
@@ -162,6 +162,7 @@ enum WorldBoolConfigs
|
||||
CONFIG_CHATLOG_ADDON,
|
||||
CONFIG_CHATLOG_BGROUND,
|
||||
CONFIG_DUNGEON_FINDER_ENABLE,
|
||||
CONFIG_AUTOBROADCAST,
|
||||
BOOL_CONFIG_VALUE_COUNT
|
||||
};
|
||||
|
||||
@@ -300,6 +301,7 @@ enum WorldIntConfigs
|
||||
CONFIG_CHARDELETE_KEEP_DAYS,
|
||||
CONFIG_CHARDELETE_METHOD,
|
||||
CONFIG_CHARDELETE_MIN_LEVEL,
|
||||
CONFIG_AUTOBROADCAST_CENTER,
|
||||
INT_CONFIG_VALUE_COUNT
|
||||
};
|
||||
|
||||
@@ -513,7 +515,7 @@ class World
|
||||
|
||||
WorldSession* FindSession(uint32 id) const;
|
||||
void AddSession(WorldSession *s);
|
||||
void SendRNDBroadcast();
|
||||
void SendAutoBroadcast();
|
||||
bool RemoveSession(uint32 id);
|
||||
/// Get the number of current active sessions
|
||||
void UpdateMaxSessionCounters();
|
||||
|
||||
Reference in New Issue
Block a user