mirror of
https://github.com/kwsch/PKHeX
synced 2025-02-17 05:48:44 +00:00
Fix battle box lock box calculation
restructure a little to only do the slot calcs if info is actually present Closes #645
This commit is contained in:
parent
251dc9c46a
commit
59ad4e2194
1 changed files with 11 additions and 7 deletions
|
@ -26,18 +26,22 @@ namespace PKHeX
|
|||
resetBoxes();
|
||||
|
||||
var demo = new byte[0x4C4].SequenceEqual(Data.Skip(PCLayout).Take(0x4C4)); // up to Battle Box values
|
||||
if (demo)
|
||||
if (demo || !Exportable)
|
||||
{
|
||||
PokeDex = -1; // Disabled
|
||||
LockedSlots = new int[0];
|
||||
}
|
||||
int lockedCount = 0;
|
||||
for (int i = 0; i < LockedSlots.Length; i++)
|
||||
else // Valid slot locking info present
|
||||
{
|
||||
short val = BitConverter.ToInt16(Data, BattleBoxFlags + i * 2);
|
||||
if (val >= 0)
|
||||
LockedSlots[lockedCount++] = (val & 0xFF + BoxSlotCount*(val >> 8)) & 0xFFFF;
|
||||
int lockedCount = 0;
|
||||
for (int i = 0; i < LockedSlots.Length; i++)
|
||||
{
|
||||
short val = BitConverter.ToInt16(Data, BattleBoxFlags + i*2);
|
||||
if (val >= 0)
|
||||
LockedSlots[lockedCount++] = (BoxSlotCount*(val >> 8) + (val & 0xFF)) & 0xFFFF;
|
||||
}
|
||||
Array.Resize(ref LockedSlots, lockedCount);
|
||||
}
|
||||
Array.Resize(ref LockedSlots, lockedCount);
|
||||
}
|
||||
|
||||
// Configuration
|
||||
|
|
Loading…
Add table
Reference in a new issue