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

@@ -7,6 +7,7 @@
#include "MotionMaster.h"
#include "CreatureAISelector.h"
#include "Creature.h"
#include "GameTime.h"
#include "ConfusedMovementGenerator.h"
#include "FleeingMovementGenerator.h"
@@ -535,7 +536,7 @@ void MotionMaster::MoveFall(uint32 id /*=0*/, bool addFlagForNPC)
{
_owner->AddUnitMovementFlag(MOVEMENTFLAG_FALLING);
_owner->m_movementInfo.SetFallTime(0);
_owner->ToPlayer()->SetFallInformation(time(NULL), _owner->GetPositionZ());
_owner->ToPlayer()->SetFallInformation(GameTime::GetGameTime(), _owner->GetPositionZ());
}
else if (_owner->GetTypeId() == TYPEID_UNIT && addFlagForNPC) // pussywizard
{

View File

@@ -13,6 +13,7 @@
#include "MoveSplineInit.h"
#include "MoveSpline.h"
#include "Player.h"
#include "GameTime.h"
#include "Spell.h"
#include "BattlegroundRV.h"
#include "VehicleDefines.h"
@@ -66,7 +67,7 @@ void TargetedMovementGeneratorMedium<T,D>::_setTargetLocation(T* owner, bool ini
if (useMMaps && !inRange && (!isPlayerPet || i_target->GetPositionZ()-z > 50.0f))
{
//useMMaps = false;
owner->m_targetsNotAcceptable[i_target->GetGUID()] = MMapTargetData(sWorld->GetGameTime()+DISALLOW_TIME_AFTER_FAIL, owner, i_target.getTarget());
owner->m_targetsNotAcceptable[i_target->GetGUID()] = MMapTargetData(GameTime::GetGameTime()+DISALLOW_TIME_AFTER_FAIL, owner, i_target.getTarget());
return;
}
@@ -174,7 +175,7 @@ void TargetedMovementGeneratorMedium<T,D>::_setTargetLocation(T* owner, bool ini
}
}
if (!forceDest && getMSTimeDiff(lastPathingFailMSTime, World::GetGameTimeMS()) < 1000)
if (!forceDest && getMSTimeDiff(lastPathingFailMSTime, GameTime::GetGameTimeMS()) < 1000)
{
lastOwnerXYZ.Relocate(-5000.0f, -5000.0f, -5000.0f);
return;
@@ -186,8 +187,8 @@ void TargetedMovementGeneratorMedium<T,D>::_setTargetLocation(T* owner, bool ini
float maxDist = MELEE_RANGE + owner->GetMeleeReach() + i_target->GetMeleeReach();
if (!forceDest && (i_path->GetPathType() & PATHFIND_NOPATH || (!i_offset && !isPlayerPet && i_target->GetExactDistSq(i_path->GetActualEndPosition().x, i_path->GetActualEndPosition().y, i_path->GetActualEndPosition().z) > maxDist*maxDist)))
{
lastPathingFailMSTime = World::GetGameTimeMS();
owner->m_targetsNotAcceptable[i_target->GetGUID()] = MMapTargetData(sWorld->GetGameTime()+DISALLOW_TIME_AFTER_FAIL, owner, i_target.getTarget());
lastPathingFailMSTime = GameTime::GetGameTimeMS();
owner->m_targetsNotAcceptable[i_target->GetGUID()] = MMapTargetData(GameTime::GetGameTime()+DISALLOW_TIME_AFTER_FAIL, owner, i_target.getTarget());
return;
}
else

View File

@@ -9,6 +9,7 @@
#include "ObjectMgr.h"
#include "World.h"
#include "Transport.h"
#include "GameTime.h"
//Flightmaster grid preloading
#include "MapManager.h"
//Creature-specific headers
@@ -317,7 +318,7 @@ void FlightPathMovementGenerator::DoFinalize(Player* player)
// this prevent cheating with landing point at lags
// when client side flight end early in comparison server side
player->StopMoving();
player->SetFallInformation(time(NULL), player->GetPositionZ());
player->SetFallInformation(GameTime::GetGameTime(), player->GetPositionZ());
}
player->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_TAXI_BENCHMARK);
@@ -406,7 +407,7 @@ bool FlightPathMovementGenerator::DoUpdate(Player* player, uint32 /*diff*/)
if (i_currentNode >= i_path.size() - 1)
{
player->CleanupAfterTaxiFlight();
player->SetFallInformation(time(NULL), player->GetPositionZ());
player->SetFallInformation(GameTime::GetGameTime(), player->GetPositionZ());
if (player->pvpInfo.IsHostile)
player->CastSpell(player, 2479, true);