server-master/srcs/_plugins/Plugin.CoreImpl/Pathfinding/ComparePfNodeMatrix.cs
2026-02-10 18:21:30 +01:00

27 lines
No EOL
732 B
C#

using System.Collections.Generic;
using WingsEmu.Game.Helpers.Damages;
namespace Plugin.CoreImpl.Pathfinding
{
internal class ComparePfNodeMatrix : IComparer<Position>
{
private readonly PathFinderNodeFast[,] _matrix;
public ComparePfNodeMatrix(PathFinderNodeFast[,] matrix) => _matrix = matrix;
public int Compare(Position a, Position b)
{
if (_matrix[a.X, a.Y].F_Gone_Plus_Heuristic > _matrix[b.X, b.Y].F_Gone_Plus_Heuristic)
{
return 1;
}
if (_matrix[a.X, a.Y].F_Gone_Plus_Heuristic < _matrix[b.X, b.Y].F_Gone_Plus_Heuristic)
{
return -1;
}
return 0;
}
}
}