fixed potential undefined behaviour when using escape rope (#4705)

This commit is contained in:
cawtds 2024-06-03 00:58:24 +02:00 committed by GitHub
parent 658b437777
commit 7404d03ea9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1041,14 +1041,10 @@ static void ItemUseOnFieldCB_EscapeRope(u8 taskId)
{
Overworld_ResetStateAfterDigEscRope();
if (I_KEY_ESCAPE_ROPE < GEN_8)
{
RemoveUsedItem();
}
else
{
CopyItemName(gSpecialVar_ItemId, gStringVar2);
StringExpandPlaceholders(gStringVar4, gText_PlayerUsedVar2);
}
RemoveBagItem(gSpecialVar_ItemId, 1);
CopyItemName(gSpecialVar_ItemId, gStringVar2);
StringExpandPlaceholders(gStringVar4, gText_PlayerUsedVar2);
gTasks[taskId].data[0] = 0;
DisplayItemMessageOnField(taskId, gStringVar4, Task_UseDigEscapeRopeOnField);
}