diff --git a/NHSE.Core/Structures/Map/Layers/LayerPositionConfig.cs b/NHSE.Core/Structures/Map/Layers/LayerPositionConfig.cs index ddc9aa6..3dda6bd 100644 --- a/NHSE.Core/Structures/Map/Layers/LayerPositionConfig.cs +++ b/NHSE.Core/Structures/Map/Layers/LayerPositionConfig.cs @@ -85,19 +85,11 @@ namespace NHSE.Core; /// if the coordinates are valid; otherwise, . public bool IsCoordinateValidRelative(int relX, int relY) { - var index = GetIndexTileRelative(relX, relY); - return (uint)index < (CountWidth * CountHeight << (TileBitShift * 2)); - } - - /// - /// Gets the requested tile index within the layer, given relative tile coordinates. - /// - /// The tile index within the layer. - public int GetIndexTileRelative(int relX, int relY) - { - // Tile ordering is top-down, left-to-right. - // In other words, Item[1] is X=0,Y=1 - return (relX * (CountHeight << TileBitShift)) + relY; + if ((uint)relX >= CountWidth << TileBitShift) + return false; + if ((uint)relY >= CountHeight << TileBitShift) + return false; + return true; } public bool IsCoordinateValidAbsolute(int absX, int absY)