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

* also split it in ResetTimeDiffRecord() and RecordTimeDiff() to avoid passing of null values.

(cherry picked from commit c9b0c8a0ca)

Conflicts:
	src/server/game/World/World.cpp
This commit is contained in:
Naios
2015-04-02 21:43:14 +02:00
parent 3e5025b773
commit 2acd2f1d97
2 changed files with 13 additions and 16 deletions

View File

@@ -2008,28 +2008,24 @@ void World::SetInitialWorldSettings()
sLog->SetRealmId(realmId);
}
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;
}
@@ -2149,7 +2145,7 @@ void World::Update(uint32 diff)
}
/// <li> Handle session updates when the timer has passed
RecordTimeDiff(NULL);
ResetTimeDiffRecord();
UpdateSessions(diff);
RecordTimeDiff("UpdateSessions");
@@ -2196,7 +2192,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

@@ -771,7 +771,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();