Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed deleting PC mon by placing another one on top with B #3360

Merged
merged 1 commit into from
Sep 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions src/pokemon_storage_system.c
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,7 @@ static void InitSummaryScreenData(void);
static void SetSelectionAfterSummaryScreen(void);
static void SetMonMarkings(u8);
static bool8 IsRemovingLastPartyMon(void);
static bool8 CanPlaceMon(void);
static bool8 CanShiftMon(void);
static bool8 IsMonBeingMoved(void);
static void TryRefreshDisplayMon(void);
Expand Down Expand Up @@ -3690,8 +3691,15 @@ static void Task_OnBPressed(u8 taskId)
PrintMessage(MSG_HOLDING_POKE);
sStorage->state = 1;
#else
PlaySE(SE_SELECT);
SetPokeStorageTask(Task_PlaceMon);
if (CanPlaceMon())
{
PlaySE(SE_SELECT);
SetPokeStorageTask(Task_PlaceMon);
}
else
{
SetPokeStorageTask(Task_PokeStorageMain);
}
#endif
}
else if (IsMovingItem())
Expand Down Expand Up @@ -6826,6 +6834,20 @@ static bool8 IsRemovingLastPartyMon(void)
return FALSE;
}

static bool8 CanPlaceMon(void)
{
if (sIsMonBeingMoved)
{
if (sCursorArea == CURSOR_AREA_IN_PARTY && GetMonData(&gPlayerParty[sCursorPosition], MON_DATA_SPECIES) == SPECIES_NONE)
return TRUE;
else if (sCursorArea == CURSOR_AREA_IN_BOX && GetBoxMonDataAt(StorageGetCurrentBox(), sCursorPosition, MON_DATA_SPECIES_OR_EGG) == SPECIES_NONE)
return TRUE;
else
return FALSE;
}
return FALSE;
}

static bool8 CanShiftMon(void)
{
if (sIsMonBeingMoved)
Expand Down
Loading