Prevent moving boxes if any team slot is in box

Closes #1079
This commit is contained in:
Kurt 2017-04-19 20:54:49 -07:00
parent ef35055d4e
commit 36515b8178
2 changed files with 7 additions and 3 deletions

View file

@ -170,7 +170,7 @@ namespace PKHeX.WinForms
else if (!SAV.SwapBox(index, index + dir)) // valid but locked
{
MoveItem(-dir); // undo
WinFormsUtil.Alert("Locked slots prevent movement of box(es).");
WinFormsUtil.Alert("Locked/Team slots prevent movement of box(es).");
}
else
changeBox(null, null);

View file

@ -414,12 +414,16 @@ namespace PKHeX.Core
int min = BoxSlotCount * box1;
int max = BoxSlotCount * box1 + BoxSlotCount;
if (LockedSlots.Any(slot => min <= slot && slot < max)) // slots locked within box
if (LockedSlots.Any(slot => min <= slot && slot < max)) // locked slot within box
return false;
if (TeamSlots.Any(slot => min <= slot && slot < max)) // team slot within box
return false;
min = BoxSlotCount * box2;
max = BoxSlotCount * box2 + BoxSlotCount;
if (LockedSlots.Any(slot => min <= slot && slot < max)) // slots locked within box
if (LockedSlots.Any(slot => min <= slot && slot < max)) // locked slot within box
return false;
if (TeamSlots.Any(slot => min <= slot && slot < max)) // team slot within box
return false;
// Data