mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-14 07:33:44 +01:00
Fix some UB exposed with GCC 10.1.0
This commit is contained in:
parent
038d247e14
commit
535189bf14
@ -52,10 +52,7 @@ struct BagMenuStruct
|
|||||||
void (*exitCallback)(void);
|
void (*exitCallback)(void);
|
||||||
u8 tilemapBuffer[0x800];
|
u8 tilemapBuffer[0x800];
|
||||||
u8 spriteId[12];
|
u8 spriteId[12];
|
||||||
u8 windowPointers[7];
|
u8 windowPointers[10];
|
||||||
u8 unk817;
|
|
||||||
u8 unk818;
|
|
||||||
u8 unk819;
|
|
||||||
u8 itemOriginalLocation;
|
u8 itemOriginalLocation;
|
||||||
u8 pocketSwitchDisabled:4;
|
u8 pocketSwitchDisabled:4;
|
||||||
u8 itemIconSlot:2;
|
u8 itemIconSlot:2;
|
||||||
|
@ -1776,7 +1776,7 @@ void Task_ChooseHowManyToToss(u8 taskId)
|
|||||||
|
|
||||||
if (AdjustQuantityAccordingToDPadInput(&tItemCount, data[2]) == TRUE)
|
if (AdjustQuantityAccordingToDPadInput(&tItemCount, data[2]) == TRUE)
|
||||||
{
|
{
|
||||||
PrintItemDepositAmount(gBagMenu->unk817, tItemCount);
|
PrintItemDepositAmount(gBagMenu->windowPointers[7], tItemCount);
|
||||||
}
|
}
|
||||||
else if (gMain.newKeys & A_BUTTON)
|
else if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
@ -2050,7 +2050,7 @@ void Task_BuyHowManyDialogueHandleInput(u8 taskId)
|
|||||||
|
|
||||||
if (AdjustQuantityAccordingToDPadInput(&tItemCount, data[2]) == TRUE)
|
if (AdjustQuantityAccordingToDPadInput(&tItemCount, data[2]) == TRUE)
|
||||||
{
|
{
|
||||||
PrintItemSoldAmount(gBagMenu->unk818, tItemCount, (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * tItemCount);
|
PrintItemSoldAmount(gBagMenu->windowPointers[8], tItemCount, (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * tItemCount);
|
||||||
}
|
}
|
||||||
else if (gMain.newKeys & A_BUTTON)
|
else if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
@ -2094,7 +2094,7 @@ void sub_81AD8C8(u8 taskId)
|
|||||||
LoadBagItemListBuffers(gBagPositionStruct.pocket);
|
LoadBagItemListBuffers(gBagPositionStruct.pocket);
|
||||||
data[0] = ListMenuInit(&gMultiuseListMenuTemplate, *scrollPos, *cursorPos);
|
data[0] = ListMenuInit(&gMultiuseListMenuTemplate, *scrollPos, *cursorPos);
|
||||||
BagMenu_PrintCursor_(data[0], 2);
|
BagMenu_PrintCursor_(data[0], 2);
|
||||||
PrintMoneyAmountInMoneyBox(gBagMenu->unk819, GetMoney(&gSaveBlock1Ptr->money), 0);
|
PrintMoneyAmountInMoneyBox(gBagMenu->windowPointers[9], GetMoney(&gSaveBlock1Ptr->money), 0);
|
||||||
gTasks[taskId].func = sub_81AD9C0;
|
gTasks[taskId].func = sub_81AD9C0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2134,7 +2134,7 @@ void sub_81ADA7C(u8 taskId)
|
|||||||
|
|
||||||
if (AdjustQuantityAccordingToDPadInput(&tItemCount, data[2]) == TRUE)
|
if (AdjustQuantityAccordingToDPadInput(&tItemCount, data[2]) == TRUE)
|
||||||
{
|
{
|
||||||
PrintItemDepositAmount(gBagMenu->unk817, tItemCount);
|
PrintItemDepositAmount(gBagMenu->windowPointers[7], tItemCount);
|
||||||
}
|
}
|
||||||
else if (gMain.newKeys & A_BUTTON)
|
else if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
|
@ -4521,7 +4521,11 @@ static void UnusedPrintMonName(u8 windowId, const u8* name, u8 left, u8 top)
|
|||||||
;
|
;
|
||||||
for (i = 0; i < nameLength; i++)
|
for (i = 0; i < nameLength; i++)
|
||||||
str[ARRAY_COUNT(str) - nameLength + i] = name[i];
|
str[ARRAY_COUNT(str) - nameLength + i] = name[i];
|
||||||
|
#ifdef UBFIX
|
||||||
|
str[ARRAY_COUNT(str) - 1] = EOS;
|
||||||
|
#else
|
||||||
str[ARRAY_COUNT(str)] = EOS;
|
str[ARRAY_COUNT(str)] = EOS;
|
||||||
|
#endif
|
||||||
PrintInfoSubMenuText(windowId, str, left, top);
|
PrintInfoSubMenuText(windowId, str, left, top);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user