Replaced time(NULL) on sGameTime.GetGameTime() this is used for better performance.

Original Timer.h divided into 2 parts. Shared project has no need to know about GameTime Singleton.
2 Identical structures with different types are now replaced with one generic templated structure and 2 typedefs.

--HG--
branch : trunk
This commit is contained in:
n0n4m3
2009-12-23 08:04:10 +01:00
parent 7ea2510980
commit 3fe0bc5254
51 changed files with 352 additions and 364 deletions
+6 -6
View File
@@ -34,7 +34,7 @@
#include "Player.h"
#include "ProgressBar.h"
#include "SpellMgr.h"
#include "TimeMgr.h"
#include "MapManager.h"
#include "BattleGround.h"
#include "BattleGroundAB.h"
@@ -552,7 +552,7 @@ void AchievementMgr::LoadFromDB(QueryResult *achievementResult, QueryResult *cri
continue;
}
if (criteria->timeLimit && time_t(date + criteria->timeLimit) < time(NULL))
if (criteria->timeLimit && time_t(date + criteria->timeLimit) < sGameTime.GetGameTime())
continue;
CriteriaProgress& progress = m_criteriaProgress[id];
@@ -612,7 +612,7 @@ void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement)
WorldPacket data(SMSG_ACHIEVEMENT_EARNED, 8+4+8);
data.append(GetPlayer()->GetPackGUID());
data << uint32(achievement->ID);
data << uint32(secsToTimeBitFields(time(NULL)));
data << uint32(secsToTimeBitFields(sGameTime.GetGameTime()));
data << uint32(0);
GetPlayer()->SendMessageToSetInRange(&data, sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY), true);
}
@@ -1623,7 +1623,7 @@ void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* entry,
progress = &m_criteriaProgress[entry->ID];
progress->counter = changeValue;
progress->date = time(NULL);
progress->date = sGameTime.GetGameTime();
}
else
{
@@ -1658,7 +1658,7 @@ void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* entry,
if(entry->timeLimit)
{
time_t now = time(NULL);
time_t now = sGameTime.GetGameTime();
if(time_t(progress->date + entry->timeLimit) < now)
progress->counter = 1;
@@ -1680,7 +1680,7 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement)
SendAchievementEarned(achievement);
CompletedAchievementData& ca = m_completedAchievements[achievement->ID];
ca.date = time(NULL);
ca.date = sGameTime.GetGameTime();
ca.changed = true;
// don't insert for ACHIEVEMENT_FLAG_REALM_FIRST_KILL since otherwise only the first group member would reach that achievement