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 else if (!SAV.SwapBox(index, index + dir)) // valid but locked
{ {
MoveItem(-dir); // undo MoveItem(-dir); // undo
WinFormsUtil.Alert("Locked slots prevent movement of box(es)."); WinFormsUtil.Alert("Locked/Team slots prevent movement of box(es).");
} }
else else
changeBox(null, null); changeBox(null, null);

View file

@ -414,12 +414,16 @@ namespace PKHeX.Core
int min = BoxSlotCount * box1; int min = BoxSlotCount * box1;
int max = BoxSlotCount * box1 + BoxSlotCount; 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; return false;
min = BoxSlotCount * box2; min = BoxSlotCount * box2;
max = BoxSlotCount * box2 + BoxSlotCount; 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; return false;
// Data // Data