aboutsummaryrefslogtreecommitdiff
path: root/src/game/Pet.cpp
diff options
context:
space:
mode:
authorn0n4m3 <none@none>2009-12-23 08:04:10 +0100
committern0n4m3 <none@none>2009-12-23 08:04:10 +0100
commit3fe0bc52541d8cdf4fa992d9b8b3101cde5848f0 (patch)
treebe5871dc19f69f4555d9ffa7c57e5d964b8e60e0 /src/game/Pet.cpp
parent7ea2510980d4b1c96f0341e9c8b9d5784862dc72 (diff)
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
Diffstat (limited to 'src/game/Pet.cpp')
-rw-r--r--src/game/Pet.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp
index 58a561c3a6f..3c8a3b3510f 100644
--- a/src/game/Pet.cpp
+++ b/src/game/Pet.cpp
@@ -30,6 +30,7 @@
#include "CreatureAI.h"
#include "Unit.h"
#include "Util.h"
+#include "TimeMgr.h"
char const* petTypeSuffix[MAX_PET_TYPE] =
{
@@ -243,7 +244,7 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
break;
}
- SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, time(NULL));
+ SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, sGameTime.GetGameTime());
SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, fields[5].GetUInt32());
SetCreatorGUID(owner->GetGUID());
@@ -301,7 +302,7 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
m_resetTalentsTime = fields[16].GetUInt64();
InitTalentForLevel(); // set original talents points before spell loading
- uint32 timediff = (time(NULL) - fields[14].GetUInt32());
+ uint32 timediff = (sGameTime.GetGameTime() - fields[14].GetUInt32());
_LoadAuras(timediff);
// load action bar, if data broken will fill later by default spells.
@@ -442,7 +443,7 @@ void Pet::SavePetToDB(PetSaveMode mode)
};
ss << "', "
- << time(NULL) << ", "
+ << sGameTime.GetGameTime() << ", "
<< uint32(m_resetTalentsCost) << ", "
<< uint64(m_resetTalentsTime) << ", "
<< GetUInt32Value(UNIT_CREATED_BY_SPELL) << ", "
@@ -1034,7 +1035,7 @@ void Pet::_LoadSpellCooldowns()
if(result)
{
- time_t curTime = time(NULL);
+ time_t curTime = sGameTime.GetGameTime();
WorldPacket data(SMSG_SPELL_COOLDOWN, (8+1+result->GetRowCount()*8));
data << GetGUID();
@@ -1077,7 +1078,7 @@ void Pet::_SaveSpellCooldowns()
{
CharacterDatabase.PExecute("DELETE FROM pet_spell_cooldown WHERE guid = '%u'", m_charmInfo->GetPetNumber());
- time_t curTime = time(NULL);
+ time_t curTime = sGameTime.GetGameTime();
// remove oudated and save active
for (CreatureSpellCooldowns::iterator itr = m_CreatureSpellCooldowns.begin(); itr != m_CreatureSpellCooldowns.end();)
@@ -1592,7 +1593,7 @@ bool Pet::resetTalents(bool no_cost)
player->ModifyMoney(-(int32)cost);
m_resetTalentsCost = cost;
- m_resetTalentsTime = time(NULL);
+ m_resetTalentsTime = sGameTime.GetGameTime();
}
if (!m_loading)
player->PetSpellInitialize();
@@ -1703,7 +1704,7 @@ void Pet::InitTalentForLevel()
uint32 Pet::resetTalentsCost() const
{
- uint32 days = (sWorld.GetGameTime() - m_resetTalentsTime)/DAY;
+ uint32 days = (sGameTime.GetGameTime() - m_resetTalentsTime)/DAY;
// The first time reset costs 10 silver; after 1 day cost is reset to 10 silver
if (m_resetTalentsCost < 10*SILVER || days > 0)