Simplify munchlax tree list usage

This commit is contained in:
Kurt
2022-08-29 17:38:27 -07:00
parent f18e884407
commit 319a671a6d
2 changed files with 10 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
using System;
using System;
using static System.Buffers.Binary.BinaryPrimitives;
namespace PKHeX.Core;
@@ -229,5 +229,5 @@ public enum PoketchApp
public readonly record struct MunchlaxTreeSet4(int Tree1, int Tree2, int Tree3, int Tree4)
{
public int[] ToArray() => new[] { Tree1, Tree2, Tree3, Tree4 };
public bool Contains(int tree) => tree == Tree1 || tree == Tree2 || tree == Tree3 || tree == Tree4;
}

View File

@@ -1,5 +1,4 @@
using System;
using System.Linq;
using System.Windows.Forms;
using PKHeX.Core;
@@ -24,15 +23,20 @@ public SAV_HoneyTree(SAV4Sinnoh sav)
};
// Get Munchlax tree for this savegame in screen
MunchlaxTrees = SAV.GetMunchlaxTrees().ToArray();
MunchlaxTrees = SAV.GetMunchlaxTrees();
const string sep = "- ";
L_Tree0.Text = string.Join(Environment.NewLine, MunchlaxTrees.Select(z => sep + CB_TreeList.Items[z]));
var names = CB_TreeList.Items;
L_Tree0.Text = string.Join(Environment.NewLine,
sep + names[MunchlaxTrees.Tree1],
sep + names[MunchlaxTrees.Tree2],
sep + names[MunchlaxTrees.Tree3],
sep + names[MunchlaxTrees.Tree4]);
CB_TreeList.SelectedIndex = 0;
}
private readonly int[] MunchlaxTrees;
private readonly MunchlaxTreeSet4 MunchlaxTrees;
private readonly ushort[][] Table;
private int entry;
private bool loading;