feat(core): Ensure that all actions are compared to fixed point in time (#1236) (#1458)

i.e. world update start
This commit is contained in:
Viste(Кирилл)
2019-02-14 21:22:17 +03:00
committed by Francesco Borzì
parent 1b7522ff0e
commit 51b8773528
108 changed files with 933 additions and 509 deletions

View File

@@ -15,6 +15,7 @@
#include "Player.h"
#include "Vehicle.h"
#include "ObjectMgr.h"
#include "GameTime.h"
#include "UpdateData.h"
#include "UpdateMask.h"
#include "Util.h"
@@ -940,7 +941,7 @@ void MovementInfo::OutDebug()
sLog->outString("guid " UI64FMTD, guid);
sLog->outString("flags %u", flags);
sLog->outString("flags2 %u", flags2);
sLog->outString("time %u current time " UI64FMTD "", flags2, uint64(::time(NULL)));
sLog->outString("time %u current time " UI64FMTD "", flags2, uint64(::GameTime::GetGameTime()));
sLog->outString("position: `%s`", pos.ToString().c_str());
if (flags & MOVEMENTFLAG_ONTRANSPORT)
{
@@ -2885,13 +2886,13 @@ void WorldObject::AddToNotify(uint16 f)
{
uint32 EVENT_VISIBILITY_DELAY = u->FindMap() ? DynamicVisibilityMgr::GetVisibilityNotifyDelay(u->FindMap()->GetEntry()->map_type) : 1000;
uint32 diff = getMSTimeDiff(u->m_last_notify_mstime, World::GetGameTimeMS());
uint32 diff = getMSTimeDiff(u->m_last_notify_mstime, GameTime::GetGameTimeMS());
if (diff >= EVENT_VISIBILITY_DELAY/2)
EVENT_VISIBILITY_DELAY /= 2;
else
EVENT_VISIBILITY_DELAY -= diff;
u->m_delayed_unit_relocation_timer = EVENT_VISIBILITY_DELAY;
u->m_last_notify_mstime = World::GetGameTimeMS()+EVENT_VISIBILITY_DELAY-1;
u->m_last_notify_mstime = GameTime::GetGameTimeMS()+EVENT_VISIBILITY_DELAY-1;
}
else if (f & NOTIFY_AI_RELOCATION)
{