mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-10 14:44:24 +00:00
Simplify memory list creation
This commit is contained in:
parent
8188208ca3
commit
09ff78ba71
1 changed files with 6 additions and 14 deletions
|
@ -22,7 +22,7 @@ namespace PKHeX.Core
|
|||
species = new Lazy<List<ComboItem>>(() => Util.GetCBList(s.specieslist));
|
||||
item = new Lazy<List<ComboItem>>(() => GetItems(format));
|
||||
genloc = new Lazy<List<ComboItem>>(() => Util.GetCBList(s.genloc));
|
||||
moves = new Lazy<List<ComboItem>>(() => Util.GetCBList(s.movelist)); // Hyperspace Fury
|
||||
moves = new Lazy<List<ComboItem>>(() => Util.GetCBList(s.movelist));
|
||||
specific = new Lazy<List<ComboItem>>(() => Util.GetCBList(s.metXY_00000, Legal.Met_XY_0));
|
||||
}
|
||||
|
||||
|
@ -46,19 +46,11 @@ namespace PKHeX.Core
|
|||
|
||||
private List<ComboItem> GetMemories()
|
||||
{
|
||||
// Memory Chooser
|
||||
int memorycount = s.memories.Length - 38;
|
||||
string[] mems = new string[memorycount];
|
||||
int[] allowed = new int[memorycount];
|
||||
for (int i = 0; i < memorycount; i++)
|
||||
{
|
||||
mems[i] = s.memories[38 + i];
|
||||
allowed[i] = i + 1;
|
||||
}
|
||||
Array.Resize(ref allowed, allowed.Length - 1);
|
||||
var memory_list1 = Util.GetCBList(new[] { mems[0] });
|
||||
Util.AddCBWithOffset(memory_list1, mems, 0, allowed);
|
||||
return memory_list1;
|
||||
const int offset = 38;
|
||||
var mems = s.memories.AsSpan(offset);
|
||||
var list = new List<ComboItem> {new(mems[0], 0)}; // none at top
|
||||
Util.AddCBWithOffset(list, mems[1..], 1); // sorted the rest
|
||||
return list;
|
||||
}
|
||||
|
||||
public ReadOnlySpan<string> GetMemoryQualities() => s.memories.AsSpan(2, 7);
|
||||
|
|
Loading…
Reference in a new issue