mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-13 07:47:07 +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
|
@ -123,7 +123,7 @@ MsgSaveBoxImportModifyYes = Yes - Modify .pk* when set to SAV
|
|||
MsgSaveBoxImportModifyCurrent = Cancel - Use current settings ({0})
|
||||
MsgSaveBoxImportModifyNo = No - Don't modify .pk*
|
||||
MsgSaveBoxImportNoFiles = No files loaded.
|
||||
MsgSaveBoxImportSuccess = Loaded {0} files to boxes.
|
||||
MsgSaveBoxImportSuccess = Loaded {0} files to boxes.
|
||||
MsgSaveBoxImportClear = Clear subsequent boxes when importing data?
|
||||
MsgSaveBoxImportClearNo = If you only want to overwrite for new data, press no.
|
||||
MsgSaveBoxImportPCBinary = PC Binary loaded.
|
||||
|
|
|
@ -123,7 +123,7 @@ MsgSaveBoxImportModifyYes = Yes - Modify .pk* when set to SAV
|
|||
MsgSaveBoxImportModifyCurrent = Cancel - Use current settings ({0})
|
||||
MsgSaveBoxImportModifyNo = No - Don't modify .pk*
|
||||
MsgSaveBoxImportNoFiles = No files loaded.
|
||||
MsgSaveBoxImportSuccess = Loaded {0} files to boxes.
|
||||
MsgSaveBoxImportSuccess = Loaded {0} files to boxes.
|
||||
MsgSaveBoxImportClear = Clear subsequent boxes when importing data?
|
||||
MsgSaveBoxImportClearNo = If you only want to overwrite for new data, press no.
|
||||
MsgSaveBoxImportPCBinary = PC Binary loaded.
|
||||
|
|
|
@ -123,7 +123,7 @@ MsgSaveBoxImportModifyYes = Yes - Modify .pk* when set to SAV
|
|||
MsgSaveBoxImportModifyCurrent = Cancel - Use current settings ({0})
|
||||
MsgSaveBoxImportModifyNo = No - Don't modify .pk*
|
||||
MsgSaveBoxImportNoFiles = No files loaded.
|
||||
MsgSaveBoxImportSuccess = Loaded {0} files to boxes.
|
||||
MsgSaveBoxImportSuccess = Loaded {0} files to boxes.
|
||||
MsgSaveBoxImportClear = Clear subsequent boxes when importing data?
|
||||
MsgSaveBoxImportClearNo = If you only want to overwrite for new data, press no.
|
||||
MsgSaveBoxImportPCBinary = PC Binary loaded.
|
||||
|
|
|
@ -123,7 +123,7 @@ MsgSaveBoxImportModifyYes = Yes - Modify .pk* when set to SAV
|
|||
MsgSaveBoxImportModifyCurrent = Cancel - Use current settings ({0})
|
||||
MsgSaveBoxImportModifyNo = No - Don't modify .pk*
|
||||
MsgSaveBoxImportNoFiles = No files loaded.
|
||||
MsgSaveBoxImportSuccess = Loaded {0} files to boxes.
|
||||
MsgSaveBoxImportSuccess = Loaded {0} files to boxes.
|
||||
MsgSaveBoxImportClear = Clear subsequent boxes when importing data?
|
||||
MsgSaveBoxImportClearNo = If you only want to overwrite for new data, press no.
|
||||
MsgSaveBoxImportPCBinary = PC Binary loaded.
|
||||
|
|
|
@ -123,7 +123,7 @@ MsgSaveBoxImportModifyYes = Yes - Modify .pk* when set to SAV
|
|||
MsgSaveBoxImportModifyCurrent = Cancel - Use current settings ({0})
|
||||
MsgSaveBoxImportModifyNo = No - Don't modify .pk*
|
||||
MsgSaveBoxImportNoFiles = No files loaded.
|
||||
MsgSaveBoxImportSuccess = Loaded {0} files to boxes.
|
||||
MsgSaveBoxImportSuccess = Loaded {0} files to boxes.
|
||||
MsgSaveBoxImportClear = Clear subsequent boxes when importing data?
|
||||
MsgSaveBoxImportClearNo = If you only want to overwrite for new data, press no.
|
||||
MsgSaveBoxImportPCBinary = PC Binary loaded.
|
||||
|
|
|
@ -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);
|
||||
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)
|
||||
|
|
|
@ -165,7 +165,7 @@ namespace PKHeX.Core
|
|||
public static string MsgSaveBoxImportModifyCurrent { get; set; } = "Cancel - Use current settings ({0})";
|
||||
public static string MsgSaveBoxImportModifyNo { get; set; } = "No - Don't modify .pk*";
|
||||
public static string MsgSaveBoxImportNoFiles { get; set; } = "No files loaded.";
|
||||
public static string MsgSaveBoxImportSuccess { get; set; } = "Loaded {0} files to boxes.";
|
||||
public static string MsgSaveBoxImportSuccess { get; set; } = "Loaded {0} files to boxes.";
|
||||
public static string MsgSaveBoxImportClear { get; set; } = "Clear subsequent boxes when importing data?";
|
||||
public static string MsgSaveBoxImportClearNo { get; set; } = "If you only want to overwrite for new data, press no.";
|
||||
public static string MsgSaveBoxImportPCBinary { get; set; } = "PC Binary loaded.";
|
||||
|
|
Loading…
Reference in a new issue