Core/Common: Merge TimeTrackerSmall with TimeTracker
Port From (https://github.com/TrinityCore/TrinityCore/commit/8809d54ca2daa230b1439f012c8b10ee88d6beae)
This commit is contained in:
@@ -24,14 +24,14 @@ namespace Game.Movement
|
||||
{
|
||||
class ChaseMovementGenerator : MovementGenerator
|
||||
{
|
||||
static int RANGE_CHECK_INTERVAL = 100; // time (ms) until we attempt to recalculate
|
||||
static uint RANGE_CHECK_INTERVAL = 100; // time (ms) until we attempt to recalculate
|
||||
|
||||
ChaseRange? _range;
|
||||
ChaseAngle? _angle;
|
||||
|
||||
PathGenerator _path;
|
||||
Position _lastTargetPosition;
|
||||
TimeTrackerSmall _rangeCheckTimer;
|
||||
TimeTracker _rangeCheckTimer;
|
||||
bool _movingTowards = true;
|
||||
bool _mutualChase = true;
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace Game.Movement
|
||||
ChaseAngle? angle = mutualChase ? null : _angle;
|
||||
|
||||
// periodically check if we're already in the expected range...
|
||||
_rangeCheckTimer.Update((int)diff);
|
||||
_rangeCheckTimer.Update(diff);
|
||||
if (_rangeCheckTimer.Passed())
|
||||
{
|
||||
_rangeCheckTimer.Reset(RANGE_CHECK_INTERVAL);
|
||||
|
||||
@@ -109,7 +109,7 @@ namespace Game.Movement
|
||||
MoveSplineInit init = new(owner);
|
||||
init.MovebyPath(_path.GetPath());
|
||||
init.SetWalk(true);
|
||||
int traveltime = init.Launch();
|
||||
uint traveltime = (uint)init.Launch();
|
||||
_timer.Reset(traveltime + RandomHelper.URand(800, 1500));
|
||||
}
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ namespace Game.Movement
|
||||
MoveSplineInit init = new(owner);
|
||||
init.MovebyPath(_path.GetPath());
|
||||
init.SetWalk(false);
|
||||
int traveltime = init.Launch();
|
||||
uint traveltime = (uint)init.Launch();
|
||||
_timer.Reset(traveltime + RandomHelper.URand(800, 1500));
|
||||
}
|
||||
|
||||
|
||||
@@ -24,13 +24,13 @@ namespace Game.Movement
|
||||
{
|
||||
public class FollowMovementGenerator : MovementGenerator
|
||||
{
|
||||
static int CHECK_INTERVAL = 100;
|
||||
static uint CHECK_INTERVAL = 100;
|
||||
static float FOLLOW_RANGE_TOLERANCE = 1.0f;
|
||||
|
||||
float _range;
|
||||
ChaseAngle _angle;
|
||||
|
||||
TimeTrackerSmall _checkTimer;
|
||||
TimeTracker _checkTimer;
|
||||
PathGenerator _path;
|
||||
Position _lastTargetPosition;
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace Game.Movement
|
||||
return true;
|
||||
}
|
||||
|
||||
_checkTimer.Update((int)diff);
|
||||
_checkTimer.Update(diff);
|
||||
if (_checkTimer.Passed())
|
||||
{
|
||||
_checkTimer.Reset(CHECK_INTERVAL);
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Game.Movement
|
||||
{
|
||||
AbstractFollower _abstractFollower;
|
||||
|
||||
static int FORMATION_MOVEMENT_INTERVAL = 1200; // sniffed (3 batch update cycles)
|
||||
static uint FORMATION_MOVEMENT_INTERVAL = 1200; // sniffed (3 batch update cycles)
|
||||
float _range;
|
||||
float _angle;
|
||||
uint _point1;
|
||||
@@ -34,7 +34,7 @@ namespace Game.Movement
|
||||
bool _hasPredictedDestination;
|
||||
|
||||
Position _lastLeaderPosition;
|
||||
TimeTrackerSmall _nextMoveTimer = new();
|
||||
TimeTracker _nextMoveTimer = new();
|
||||
|
||||
public FormationMovementGenerator(Unit leader, float range, float angle, uint point1, uint point2)
|
||||
{
|
||||
@@ -128,7 +128,7 @@ namespace Game.Movement
|
||||
return true;
|
||||
}
|
||||
|
||||
_nextMoveTimer.Update((int)diff);
|
||||
_nextMoveTimer.Update(diff);
|
||||
if (_nextMoveTimer.Passed())
|
||||
{
|
||||
_nextMoveTimer.Reset(FORMATION_MOVEMENT_INTERVAL);
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Game.Movement
|
||||
MoveSplineInit _splineInit;
|
||||
MovementGeneratorType _type;
|
||||
uint _pointId;
|
||||
TimeTrackerSmall _duration;
|
||||
TimeTracker _duration;
|
||||
|
||||
uint _arrivalSpellId;
|
||||
ObjectGuid _arrivalSpellTargetGuid;
|
||||
@@ -57,7 +57,7 @@ namespace Game.Movement
|
||||
RemoveFlag(MovementGeneratorFlags.InitializationPending | MovementGeneratorFlags.Deactivated);
|
||||
AddFlag(MovementGeneratorFlags.Initialized);
|
||||
|
||||
_duration.Reset(_splineInit.Launch());
|
||||
_duration.Reset((uint)_splineInit.Launch());
|
||||
}
|
||||
|
||||
public override void Reset(Unit owner)
|
||||
@@ -72,7 +72,7 @@ namespace Game.Movement
|
||||
|
||||
// Cyclic splines never expire, so update the duration only if it's not cyclic
|
||||
if (!owner.MoveSpline.IsCyclic())
|
||||
_duration.Update((int)diff);
|
||||
_duration.Update(diff);
|
||||
|
||||
if (_duration.Passed() || owner.MoveSpline.Finalized())
|
||||
{
|
||||
|
||||
@@ -188,7 +188,7 @@ namespace Game.Movement
|
||||
MoveSplineInit init = new(owner);
|
||||
init.MovebyPath(_path.GetPath());
|
||||
init.SetWalk(walk);
|
||||
int splineDuration = init.Launch();
|
||||
uint splineDuration = (uint)init.Launch();
|
||||
|
||||
--_wanderSteps;
|
||||
if (_wanderSteps != 0) // Creature has yet to do steps before pausing
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Game.Movement
|
||||
{
|
||||
public WaypointMovementGenerator(uint pathId = 0, bool repeating = true)
|
||||
{
|
||||
_nextMoveTime = new TimeTrackerSmall(0);
|
||||
_nextMoveTime = new TimeTracker(0);
|
||||
_pathId = pathId;
|
||||
_repeating = repeating;
|
||||
_loadedFromDB = true;
|
||||
@@ -40,7 +40,7 @@ namespace Game.Movement
|
||||
|
||||
public WaypointMovementGenerator(WaypointPath path, bool repeating = true)
|
||||
{
|
||||
_nextMoveTime = new TimeTrackerSmall(0);
|
||||
_nextMoveTime = new TimeTracker(0);
|
||||
_repeating = repeating;
|
||||
_path = path;
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Game.Movement
|
||||
return;
|
||||
|
||||
AddFlag(MovementGeneratorFlags.TimedPaused);
|
||||
_nextMoveTime.Reset((int)timer);
|
||||
_nextMoveTime.Reset(timer);
|
||||
RemoveFlag(MovementGeneratorFlags.Paused);
|
||||
}
|
||||
else
|
||||
@@ -73,7 +73,7 @@ namespace Game.Movement
|
||||
public override void Resume(uint overrideTimer = 0)
|
||||
{
|
||||
if (overrideTimer != 0)
|
||||
_nextMoveTime.Reset((int)overrideTimer);
|
||||
_nextMoveTime.Reset(overrideTimer);
|
||||
|
||||
if (_nextMoveTime.Passed())
|
||||
_nextMoveTime.Reset(1); // Needed so that Update does not behave as if node was reached
|
||||
@@ -251,7 +251,7 @@ namespace Game.Movement
|
||||
if (waypoint.delay != 0)
|
||||
{
|
||||
owner.ClearUnitState(UnitState.RoamingMove);
|
||||
_nextMoveTime.Reset((int)waypoint.delay);
|
||||
_nextMoveTime.Reset(waypoint.delay);
|
||||
}
|
||||
|
||||
if (waypoint.eventId != 0 && RandomHelper.URand(0, 99) < waypoint.eventChance)
|
||||
@@ -398,7 +398,7 @@ namespace Game.Movement
|
||||
|
||||
bool UpdateTimer(uint diff)
|
||||
{
|
||||
_nextMoveTime.Update((int)diff);
|
||||
_nextMoveTime.Update(diff);
|
||||
if (_nextMoveTime.Passed())
|
||||
{
|
||||
_nextMoveTime.Reset(0);
|
||||
@@ -411,7 +411,7 @@ namespace Game.Movement
|
||||
|
||||
public override void UnitSpeedChanged() { AddFlag(MovementGeneratorFlags.SpeedUpdatePending); }
|
||||
|
||||
TimeTrackerSmall _nextMoveTime;
|
||||
TimeTracker _nextMoveTime;
|
||||
uint _pathId;
|
||||
bool _repeating;
|
||||
bool _loadedFromDB;
|
||||
|
||||
Reference in New Issue
Block a user