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 committed 2009-12-23 08:04:10 +01:00
1 parent 7ea2510980
commit 3fe0bc5254
51 files changed
+352 -364

No files matched your search

+6 -5
View File
@@ -55,6 +55,7 @@
#include "AuctionHouseBot.h"
#include "CreatureEventAIMgr.h"
#include "DBCEnums.h"
#include "TimeMgr.h"
bool ChatHandler::HandleAHBotOptionsCommand(const char *args)
{
@@ -4614,7 +4615,7 @@ bool ChatHandler::HandleNpcInfoCommand(const char* /*args*/)
uint32 Entry = target->GetEntry();
CreatureInfo const* cInfo = target->GetCreatureInfo();
int32 curRespawnDelay = target->GetRespawnTimeEx()-time(NULL);
int32 curRespawnDelay = target->GetRespawnTimeEx()-sGameTime.GetGameTime();
if(curRespawnDelay < 0)
curRespawnDelay = 0;
std::string curRespawnDelayStr = secsToTimeString(curRespawnDelay,true);
@@ -5974,7 +5975,7 @@ bool ChatHandler::HandleBanInfoHelper(uint32 accountid, char const* accountname)
time_t unbandate = time_t(fields[3].GetUInt64());
bool active = false;
if(fields[2].GetBool() && (fields[1].GetUInt64() == (uint64)0 ||unbandate >= time(NULL)) )
if(fields[2].GetBool() && (fields[1].GetUInt64() == (uint64)0 ||unbandate >= sGameTime.GetGameTime()) )
active = true;
bool permanent = (fields[1].GetUInt64() == (uint64)0);
std::string bantime = permanent?GetTrinityString(LANG_BANINFO_INFINITE):secsToTimeString(fields[1].GetUInt64(), true);
@@ -6824,7 +6825,7 @@ bool ChatHandler::HandleInstanceListBindsCommand(const char* /*args*/)
for (Player::BoundInstancesMap::const_iterator itr = binds.begin(); itr != binds.end(); ++itr)
{
InstanceSave *save = itr->second.save;
std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL));
std::string timeleft = GetTimeString(save->GetResetTime() - sGameTime.GetGameTime());
PSendSysMessage("map: %d inst: %d perm: %s diff: %d canReset: %s TTR: %s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str());
counter++;
}
@@ -6840,7 +6841,7 @@ bool ChatHandler::HandleInstanceListBindsCommand(const char* /*args*/)
for (Group::BoundInstancesMap::const_iterator itr = binds.begin(); itr != binds.end(); ++itr)
{
InstanceSave *save = itr->second.save;
std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL));
std::string timeleft = GetTimeString(save->GetResetTime() - sGameTime.GetGameTime());
PSendSysMessage("map: %d inst: %d perm: %s diff: %d canReset: %s TTR: %s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str()); counter++;
}
}
@@ -6869,7 +6870,7 @@ bool ChatHandler::HandleInstanceUnbindCommand(const char *args)
if(itr->first != player->GetMapId())
{
InstanceSave *save = itr->second.save;
std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL));
std::string timeleft = GetTimeString(save->GetResetTime() - sGameTime.GetGameTime());
PSendSysMessage("unbinding map: %d inst: %d perm: %s diff: %d canReset: %s TTR: %s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str());
player->UnbindInstance(itr, Difficulty(i));
counter++;