mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-10-01 20:56:59 -05:00
Check destination validity
locked slot would throw exception
This commit is contained in:
@@ -4204,7 +4204,7 @@ private void pbBoxSlot_MouseMove(object sender, MouseEventArgs e)
|
||||
getQuickFiller(pb, SAV.getStoredSlot(DragInfo.slotSourceOffset));
|
||||
pb.BackgroundImage = null;
|
||||
|
||||
if (DragInfo.SameBox)
|
||||
if (DragInfo.SameBox && DragInfo.DestinationValid)
|
||||
SlotPictureBoxes[DragInfo.slotDestinationSlotNumber].Image = img;
|
||||
|
||||
if (result == DragDropEffects.Copy) // viewed in tabs, apply 'view' highlight
|
||||
@@ -4242,7 +4242,6 @@ private void pbBoxSlot_DragDrop(object sender, DragEventArgs e)
|
||||
if (Directory.Exists(files[0])) { loadBoxesFromDB(files[0]); return; }
|
||||
if (DragInfo.SameSlot)
|
||||
return;
|
||||
if (DragInfo.SameBox)
|
||||
if (SAV.getIsSlotLocked(DragInfo.slotDestinationBoxNumber, DragInfo.slotDestinationSlotNumber))
|
||||
{
|
||||
DragInfo.slotDestinationSlotNumber = -1; // Invalidate
|
||||
@@ -4368,8 +4367,8 @@ public static class DragInfo
|
||||
|
||||
public static bool SameBox => slotSourceBoxNumber > -1 && slotSourceBoxNumber == slotDestinationBoxNumber;
|
||||
public static bool SameSlot => slotSourceSlotNumber == slotDestinationSlotNumber && slotSourceBoxNumber == slotDestinationBoxNumber;
|
||||
public static bool SourceValid => slotSourceBoxNumber > -1 || SourceParty;
|
||||
public static bool DestinationValid => slotDestinationBoxNumber > -1 || DestinationParty;
|
||||
public static bool SourceValid => slotSourceSlotNumber > -1 && (slotSourceBoxNumber > -1 || SourceParty);
|
||||
public static bool DestinationValid => slotDestinationSlotNumber > -1 && (slotDestinationBoxNumber > -1 || DestinationParty);
|
||||
public static bool SourceParty => 30 <= slotSourceSlotNumber && slotSourceSlotNumber < 36;
|
||||
public static bool DestinationParty => 30 <= slotDestinationSlotNumber && slotDestinationSlotNumber < 36;
|
||||
|
||||
|
||||
@@ -213,7 +213,7 @@ private void pbBoxSlot_MouseMove(object sender, MouseEventArgs e)
|
||||
getQuickFiller(pb, SAV.getStoredSlot(DragInfo.slotSourceOffset));
|
||||
pb.BackgroundImage = null;
|
||||
|
||||
if (DragInfo.SameBox)
|
||||
if (DragInfo.SameBox && DragInfo.DestinationValid)
|
||||
SlotPictureBoxes[DragInfo.slotDestinationSlotNumber].Image = img;
|
||||
}
|
||||
catch (Exception x)
|
||||
|
||||
Reference in New Issue
Block a user