mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-29 23:40:27 +00:00
Fix Import Count on Load Boxes (#2308)
Calculation was wrong if non-overwrite is selected. Also fixed OCD-triggering extra space in output message.
This commit is contained in:
parent
7421b137eb
commit
7625ab66b4
7 changed files with 13 additions and 9 deletions
|
@ -121,6 +121,7 @@ namespace PKHeX.Core
|
|||
int startCount = boxStart * SAV.BoxSlotCount;
|
||||
int maxCount = SAV.SlotCount;
|
||||
int index = startCount;
|
||||
int nonOverwriteImport = 0;
|
||||
|
||||
foreach (var pk in compat)
|
||||
{
|
||||
|
@ -128,20 +129,23 @@ namespace PKHeX.Core
|
|||
{
|
||||
while (SAV.IsSlotOverwriteProtected(index))
|
||||
++index;
|
||||
|
||||
SAV.SetBoxSlotAtIndex(pk, index, noSetb);
|
||||
}
|
||||
else
|
||||
{
|
||||
index = SAV.NextOpenBoxSlot(index-1);
|
||||
if (index < 0) // Boxes full!
|
||||
break;
|
||||
}
|
||||
|
||||
SAV.SetBoxSlotAtIndex(pk, index, noSetb);
|
||||
nonOverwriteImport++;
|
||||
}
|
||||
|
||||
if (++index == maxCount) // Boxes full!
|
||||
break;
|
||||
}
|
||||
return index - startCount; // actual imported count
|
||||
return (overwrite) ? index - startCount : nonOverwriteImport; // actual imported count
|
||||
}
|
||||
|
||||
public static IEnumerable<PKM> GetCompatible(this SaveFile SAV, IEnumerable<PKM> pks)
|
||||
|
|
Loading…
Reference in a new issue