mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-08-26 18:57:47 -05:00
Add delete criteria method providing for box clear
Can opt to not delete a slot
This commit is contained in:
@@ -601,7 +601,7 @@ public void SortBoxes(int BoxStart = 0, int BoxEnd = -1, Func<IEnumerable<PKM>,
|
||||
Sorted.CopyTo(BD, start);
|
||||
BoxData = BD;
|
||||
}
|
||||
public void ClearBoxes(int BoxStart = 0, int BoxEnd = -1)
|
||||
public void ClearBoxes(int BoxStart = 0, int BoxEnd = -1, Func<PKM, bool> deleteCriteria = null)
|
||||
{
|
||||
if (BoxEnd < 0)
|
||||
BoxEnd = BoxCount - 1;
|
||||
@@ -614,7 +614,17 @@ public void ClearBoxes(int BoxStart = 0, int BoxEnd = -1)
|
||||
{
|
||||
int offset = GetBoxOffset(i);
|
||||
for (int p = 0; p < BoxSlotCount; p++)
|
||||
SetData(blank, offset + SIZE_STORED * p);
|
||||
{
|
||||
var ofs = offset + SIZE_STORED * p;
|
||||
if (deleteCriteria != null)
|
||||
{
|
||||
var pk = GetStoredSlot(ofs);
|
||||
if (!deleteCriteria(pk))
|
||||
continue;
|
||||
}
|
||||
|
||||
SetData(blank, ofs);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void ModifyBoxes(Action<PKM> action, int BoxStart = 0, int BoxEnd = -1)
|
||||
|
||||
Reference in New Issue
Block a user