Some Cleanups
This commit is contained in:
@@ -67,7 +67,7 @@ namespace Game.Movement
|
||||
if (!nodes.Empty())
|
||||
{
|
||||
TaxiPathNodeRecord start = nodes[0];
|
||||
TaxiPathNodeRecord end = nodes[nodes.Length - 1];
|
||||
TaxiPathNodeRecord end = nodes[^1];
|
||||
bool passedPreviousSegmentProximityCheck = false;
|
||||
for (uint i = 0; i < nodes.Length; ++i)
|
||||
{
|
||||
@@ -83,7 +83,7 @@ namespace Game.Movement
|
||||
else
|
||||
{
|
||||
_path.RemoveAt(_path.Count - 1);
|
||||
_pointsForPathSwitch[_pointsForPathSwitch.Count - 1].PathIndex -= 1;
|
||||
_pointsForPathSwitch[^1].PathIndex -= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -468,7 +468,7 @@ namespace Game.Movement
|
||||
{
|
||||
float[] pathPoints = new float[74 * 3];
|
||||
int pointCount = 0;
|
||||
uint dtResult = Detour.DT_FAILURE;
|
||||
uint dtResult;
|
||||
|
||||
if (_straightLine)
|
||||
{
|
||||
@@ -556,7 +556,7 @@ namespace Game.Movement
|
||||
if (Dist3DSqr(GetActualEndPosition(), GetEndPosition()) < 0.3f * Dist3DSqr(GetStartPosition(), GetEndPosition()))
|
||||
{
|
||||
SetActualEndPosition(GetEndPosition());
|
||||
_pathPoints[_pathPoints.Length - 1] = GetEndPosition();
|
||||
_pathPoints[^1] = GetEndPosition();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -636,7 +636,7 @@ namespace Game.Movement
|
||||
Span<float> span = steerPath;
|
||||
// Stop at Off-Mesh link or when point is further than slop away.
|
||||
if ((steerPathFlags[ns].HasAnyFlag((byte)Detour.dtStraightPathFlags.DT_STRAIGHTPATH_OFFMESH_CONNECTION) ||
|
||||
!InRangeYZX(span.Slice((int)ns * 3).ToArray(), startPos, minTargetDist, 1000.0f)))
|
||||
!InRangeYZX(span[((int)ns * 3)..].ToArray(), startPos, minTargetDist, 1000.0f)))
|
||||
break;
|
||||
ns++;
|
||||
}
|
||||
@@ -678,11 +678,7 @@ namespace Game.Movement
|
||||
while (npolys != 0 && nsmoothPath < maxSmoothPathSize)
|
||||
{
|
||||
// Find location to steer towards.
|
||||
float[] steerPos;
|
||||
Detour.dtStraightPathFlags steerPosFlag;
|
||||
ulong steerPosRef = 0;
|
||||
|
||||
if (!GetSteerTarget(iterPos, targetPos, 0.3f, polys, npolys, out steerPos, out steerPosFlag, out steerPosRef))
|
||||
if (!GetSteerTarget(iterPos, targetPos, 0.3f, polys, npolys, out float[] steerPos, out Detour.dtStraightPathFlags steerPosFlag, out ulong steerPosRef))
|
||||
break;
|
||||
|
||||
bool endOfPath = steerPosFlag.HasAnyFlag(Detour.dtStraightPathFlags.DT_STRAIGHTPATH_END);
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace Game.Movement
|
||||
return (uint)init.Launch();
|
||||
}
|
||||
|
||||
void SendSplineFor(Unit me, int index, uint toNext)
|
||||
void SendSplineFor(Unit me, int index, ref uint toNext)
|
||||
{
|
||||
Cypher.Assert(index < _chainSize);
|
||||
Log.outDebug(LogFilter.Movement, "{0}: Sending spline for {1}.", me.GetGUID().ToString(), index);
|
||||
@@ -90,7 +90,7 @@ namespace Game.Movement
|
||||
_nextFirstWP = (byte)(thisLink.Points.Count - 1);
|
||||
}
|
||||
Span<Vector3> span = thisLink.Points.ToArray();
|
||||
SendPathSpline(me, span.Slice(_nextFirstWP - 1));
|
||||
SendPathSpline(me, span[(_nextFirstWP - 1)..]);
|
||||
Log.outDebug(LogFilter.Movement, "{0}: Resumed spline chain generator from resume state.", me.GetGUID().ToString());
|
||||
++_nextIndex;
|
||||
if (_nextIndex >= _chainSize)
|
||||
@@ -102,7 +102,7 @@ namespace Game.Movement
|
||||
else
|
||||
{
|
||||
_msToNext = Math.Max(_chain[_nextIndex].TimeToNext, 1u);
|
||||
SendSplineFor(me, _nextIndex, _msToNext);
|
||||
SendSplineFor(me, _nextIndex, ref _msToNext);
|
||||
++_nextIndex;
|
||||
if (_nextIndex >= _chainSize)
|
||||
_msToNext = 0;
|
||||
@@ -141,7 +141,7 @@ namespace Game.Movement
|
||||
// Send next spline
|
||||
Log.outDebug(LogFilter.Movement, "{0}: Should send spline {1} ({2} ms late).", me.GetGUID().ToString(), _nextIndex, diff - _msToNext);
|
||||
_msToNext = Math.Max(_chain[_nextIndex].TimeToNext, 1u);
|
||||
SendSplineFor(me, _nextIndex, _msToNext);
|
||||
SendSplineFor(me, _nextIndex, ref _msToNext);
|
||||
++_nextIndex;
|
||||
if (_nextIndex >= _chainSize)
|
||||
{
|
||||
|
||||
@@ -228,7 +228,7 @@ namespace Game.Movement
|
||||
init.Launch();
|
||||
|
||||
// inform formation
|
||||
creature.SignalFormationMovement(formationDest, waypoint.id, waypoint.moveType, (waypoint.orientation != 0 && waypoint.delay != 0) ? true : false);
|
||||
creature.SignalFormationMovement(formationDest, waypoint.id, waypoint.moveType, (waypoint.orientation != 0 && waypoint.delay != 0));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -307,7 +307,7 @@ namespace Game.Movement
|
||||
|
||||
public override void Pause(uint timer = 0)
|
||||
{
|
||||
_stalled = timer != 0 ? false : true;
|
||||
_stalled = timer == 0;
|
||||
_nextMoveTime.Reset(timer != 0 ? (int)timer : 1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user