PKHeX/PKHeX.Core/Legality/Areas/TreeCoordinates.cs
Kurt fefc38bacb Minor debug optimizations
Trees:
- Only retain the objects needed after calculation
- Reduce size of TreeCoordinates and remove allocation penalty (now a struct)

No more warnings for Release compilation :D
2020-11-28 14:55:09 -08:00

27 lines
585 B
C#

namespace PKHeX.Core
{
/// <summary>
/// Coordinate / Index Relationship for a Generation 2 Headbutt Tree
/// </summary>
internal readonly struct TreeCoordinates
{
#if DEBUG
private readonly int X;
private readonly int Y;
#endif
public readonly byte Index;
public TreeCoordinates(in int x, in int y)
{
#if DEBUG
X = x;
Y = y;
#endif
Index = (byte)(((x * y) + x + y) / 5 % 10);
}
#if DEBUG
public override string ToString() => $"{Index} @ ({X:D2},{Y:D2})";
#endif
}
}