mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-27 14:30:56 +00:00
fefc38bacb
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
27 lines
585 B
C#
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
|
|
}
|
|
}
|