feat(Core/Time): Implement saparated manager for game time (#8630)

This commit is contained in:
Kargatum
2022-01-24 17:55:00 +07:00
committed by GitHub
parent 12da792a90
commit 8b7df23f06
129 changed files with 1147 additions and 817 deletions

View File

@@ -19,6 +19,7 @@
#include "CharacterCache.h"
#include "Common.h"
#include "DatabaseEnv.h"
#include "GameTime.h"
#include "Log.h"
#include "ObjectAccessor.h"
#include "Opcodes.h"
@@ -30,13 +31,9 @@ Corpse::Corpse(CorpseType type) : WorldObject(type != CORPSE_BONES), m_type(type
{
m_objectType |= TYPEMASK_CORPSE;
m_objectTypeId = TYPEID_CORPSE;
m_updateFlag = (UPDATEFLAG_LOWGUID | UPDATEFLAG_STATIONARY_POSITION | UPDATEFLAG_POSITION);
m_valuesCount = CORPSE_END;
m_time = time(nullptr);
m_time = GameTime::GetGameTime().count();
lootRecipient = nullptr;
}
@@ -195,3 +192,8 @@ bool Corpse::IsExpired(time_t t) const
else
return m_time < t - 3 * DAY;
}
void Corpse::ResetGhostTime()
{
m_time = GameTime::GetGameTime().count();
}

View File

@@ -66,7 +66,7 @@ public:
[[nodiscard]] ObjectGuid GetOwnerGUID() const { return GetGuidValue(CORPSE_FIELD_OWNER); }
[[nodiscard]] time_t const& GetGhostTime() const { return m_time; }
void ResetGhostTime() { m_time = time(nullptr); }
void ResetGhostTime();
[[nodiscard]] CorpseType GetType() const { return m_type; }
[[nodiscard]] CellCoord const& GetCellCoord() const { return _cellCoord; }