Core/World: Remove va_list from World::RecordTimeDiff.

* also split it in ResetTimeDiffRecord() and RecordTimeDiff() to avoid passing of null values.
This commit is contained in:
Naios
2015-03-28 18:55:54 +01:00
parent df4723af25
commit c9b0c8a0ca
2 changed files with 13 additions and 16 deletions

View File

@@ -1914,28 +1914,24 @@ void World::DetectDBCLang()
TC_LOG_INFO("server.loading", "Using %s DBC Locale as default. All available DBC locales: %s", localeNames[m_defaultDbcLocale], availableLocalsStr.empty() ? "<none>" : availableLocalsStr.c_str());
}
void World::RecordTimeDiff(const char *text, ...)
void World::ResetTimeDiffRecord()
{
if (m_updateTimeCount != 1)
return;
if (!text)
{
m_currentTime = getMSTime();
m_currentTime = getMSTime();
}
void World::RecordTimeDiff(std::string const& text)
{
if (m_updateTimeCount != 1)
return;
}
uint32 thisTime = getMSTime();
uint32 diff = getMSTimeDiff(m_currentTime, thisTime);
if (diff > m_int_configs[CONFIG_MIN_LOG_UPDATE])
{
va_list ap;
char str[256];
va_start(ap, text);
vsnprintf(str, 256, text, ap);
va_end(ap);
TC_LOG_INFO("misc", "Difftime %s: %u.", str, diff);
}
TC_LOG_INFO("misc", "Difftime %s: %u.", text.c_str(), diff);
m_currentTime = thisTime;
}
@@ -2052,7 +2048,7 @@ void World::Update(uint32 diff)
}
/// <li> Handle session updates when the timer has passed
RecordTimeDiff(NULL);
ResetTimeDiffRecord();
UpdateSessions(diff);
RecordTimeDiff("UpdateSessions");
@@ -2099,7 +2095,7 @@ void World::Update(uint32 diff)
/// <li> Handle all other objects
///- Update objects when the timer has passed (maps, transport, creatures, ...)
RecordTimeDiff(NULL);
ResetTimeDiffRecord();
sMapMgr->Update(diff);
RecordTimeDiff("UpdateMapMgr");

View File

@@ -741,7 +741,8 @@ class World
void LoadDBVersion();
char const* GetDBVersion() const { return m_DBVersion.c_str(); }
void RecordTimeDiff(const char * text, ...);
void ResetTimeDiffRecord();
void RecordTimeDiff(std::string const& text);
void LoadAutobroadcasts();