NHSE/NHSE.Core/Structures/Map/AcreSelectionGrid.cs
Kurt 766e58ffec stash
working on it, untested.
decoupled 99% of the logic, need to ensure the rendering uses the correct item grid which now includes deepsea L+R sides for 3.0.0
2026-01-16 00:51:19 -06:00

23 lines
818 B
C#

namespace NHSE.Core;
/// <summary>
/// Basic logic implementation for interacting with the manipulatable map grid.
/// </summary>
public abstract record AcreSelectionGrid(TileGridViewport TileInfo)
{
protected int GetAcreTileIndex(int acreIndex, int tileIndex)
{
var acre = AcreCoordinate.Acres[acreIndex];
var x = (tileIndex % TileInfo.ViewWidth);
var y = (tileIndex / TileInfo.ViewHeight);
return TileInfo.GetTileIndex(acre.X, acre.Y, x, y);
}
public int GetAcre(int x, int y) => (x / TileInfo.ViewWidth) + ((y / TileInfo.ViewHeight) * TileInfo.Columns);
public void GetViewAnchorCoordinates(int acre, out int x, out int y)
{
x = (acre % TileInfo.Columns) * TileInfo.ViewWidth;
y = (acre / TileInfo.Columns) * TileInfo.ViewHeight;
}
}