diff --git a/Projects/Server/Maps/Map.ClientByDistanceEnumerator.cs b/Projects/Server/Maps/Map.ClientByDistanceEnumerator.cs index 18a443c61..64c7b3851 100644 --- a/Projects/Server/Maps/Map.ClientByDistanceEnumerator.cs +++ b/Projects/Server/Maps/Map.ClientByDistanceEnumerator.cs @@ -173,7 +173,7 @@ public partial class Map if (current != null) { - _minDistance = MinDistSqToSectorRect(_center.m_X, _center.m_Y, _currentSectorX, _currentSectorY); + _minDistance = MinDistToSectorSqrt(_center.m_X, _center.m_Y, _currentSectorX, _currentSectorY); } } @@ -266,7 +266,7 @@ public partial class Map } [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static int MinDistSqToSectorRect(int cx, int cy, int sectorX, int sectorY) + private static int MinDistToSectorSqrt(int cx, int cy, int sectorX, int sectorY) { var x0 = sectorX * SectorSize; var y0 = sectorY * SectorSize; @@ -293,7 +293,7 @@ public partial class Map dy = cy - y1; } - return dx * dx + dy * dy; + return (int)Math.Sqrt(dx * dx + dy * dy); } } } diff --git a/Projects/Server/Maps/Map.ItemByDistanceEnumerator.cs b/Projects/Server/Maps/Map.ItemByDistanceEnumerator.cs index dd022e0c1..74174d9e0 100644 --- a/Projects/Server/Maps/Map.ItemByDistanceEnumerator.cs +++ b/Projects/Server/Maps/Map.ItemByDistanceEnumerator.cs @@ -201,7 +201,7 @@ public partial class Map if (current != null) { - _minDistance = MinDistSqToSectorRect(_center.m_X, _center.m_Y, _currentSectorX, _currentSectorY); + _minDistance = MinDistToSectorSqrt(_center.m_X, _center.m_Y, _currentSectorX, _currentSectorY); } } @@ -292,7 +292,7 @@ public partial class Map } [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static int MinDistSqToSectorRect(int cx, int cy, int sectorX, int sectorY) + private static int MinDistToSectorSqrt(int cx, int cy, int sectorX, int sectorY) { var x0 = sectorX * SectorSize; var y0 = sectorY * SectorSize; @@ -319,7 +319,7 @@ public partial class Map dy = cy - y1; } - return dx * dx + dy * dy; + return (int)Math.Sqrt(dx * dx + dy * dy); } } } diff --git a/Projects/Server/Maps/Map.MobileByDistanceEnumerator.cs b/Projects/Server/Maps/Map.MobileByDistanceEnumerator.cs index d508cd8d0..71449e550 100644 --- a/Projects/Server/Maps/Map.MobileByDistanceEnumerator.cs +++ b/Projects/Server/Maps/Map.MobileByDistanceEnumerator.cs @@ -196,7 +196,7 @@ public partial class Map if (current != null) { - _minDistance = MinDistSqToSectorRect(_center.m_X, _center.m_Y, _currentSectorX, _currentSectorY); + _minDistance = MinDistToSectorSqrt(_center.m_X, _center.m_Y, _currentSectorX, _currentSectorY); } } @@ -287,7 +287,7 @@ public partial class Map } [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static int MinDistSqToSectorRect(int cx, int cy, int sectorX, int sectorY) + private static int MinDistToSectorSqrt(int cx, int cy, int sectorX, int sectorY) { var x0 = sectorX * SectorSize; var y0 = sectorY * SectorSize; @@ -314,7 +314,7 @@ public partial class Map dy = cy - y1; } - return dx * dx + dy * dy; + return (int)Math.Sqrt(dx * dx + dy * dy); } } }