Fix item duplication glitch (#4844)
* Fix Toxic Chain file acting up * Fix item dupe glitch
This commit is contained in:
parent
b9138390af
commit
87b21c2ce5
1 changed files with 12 additions and 14 deletions
|
@ -6434,23 +6434,10 @@ static void SetPlacedMonData(u8 boxId, u8 position)
|
|||
|
||||
static void PurgeMonOrBoxMon(u8 boxId, u8 position)
|
||||
{
|
||||
u16 item = ITEM_NONE;
|
||||
|
||||
if (boxId == TOTAL_BOXES_COUNT)
|
||||
{
|
||||
if (OW_PC_RELEASE_ITEM >= GEN_8)
|
||||
item = GetMonData(&gPlayerParty[position], MON_DATA_HELD_ITEM);
|
||||
ZeroMonData(&gPlayerParty[position]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (OW_PC_RELEASE_ITEM >= GEN_8)
|
||||
item = GetBoxMonDataAt(boxId, position, MON_DATA_HELD_ITEM);
|
||||
ZeroBoxMonAt(boxId, position);
|
||||
}
|
||||
|
||||
if (item != ITEM_NONE)
|
||||
AddBagItem(item, 1);
|
||||
}
|
||||
|
||||
static void SetShiftedMonData(u8 boxId, u8 position)
|
||||
|
@ -6530,6 +6517,7 @@ static bool8 TryHideReleaseMon(void)
|
|||
static void ReleaseMon(void)
|
||||
{
|
||||
u8 boxId;
|
||||
u16 item = ITEM_NONE;
|
||||
|
||||
DestroyReleaseMonIcon();
|
||||
if (sIsMonBeingMoved)
|
||||
|
@ -6539,11 +6527,21 @@ static void ReleaseMon(void)
|
|||
else
|
||||
{
|
||||
if (sCursorArea == CURSOR_AREA_IN_PARTY)
|
||||
{
|
||||
boxId = TOTAL_BOXES_COUNT;
|
||||
if (OW_PC_RELEASE_ITEM >= GEN_8)
|
||||
item = GetMonData(&gPlayerParty[sCursorPosition], MON_DATA_HELD_ITEM);
|
||||
}
|
||||
else
|
||||
{
|
||||
boxId = StorageGetCurrentBox();
|
||||
|
||||
if (OW_PC_RELEASE_ITEM >= GEN_8)
|
||||
item = GetBoxMonDataAt(boxId, sCursorPosition, MON_DATA_HELD_ITEM);
|
||||
}
|
||||
|
||||
PurgeMonOrBoxMon(boxId, sCursorPosition);
|
||||
if (item != ITEM_NONE)
|
||||
AddBagItem(item, 1);
|
||||
}
|
||||
TryRefreshDisplayMon();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue