Various BUGFIXes and UBFIXes

This commit is contained in:
ExpoSeed
2021-05-15 15:56:17 -05:00
parent ab8318cc79
commit 361fa594b3
10 changed files with 48 additions and 9 deletions

View File

@@ -1399,8 +1399,12 @@ void GenerateBattlePyramidWildMon(void)
for (i = 0; i < MAX_MON_MOVES; i++)
SetMonMoveSlot(&gEnemyParty[0], wildMons[id].moves[i], i);
// BUG: Reading outside the array as lvl was used for mon level instead of frontier lvl mode.
// UB: Reading outside the array as lvl was used for mon level instead of frontier lvl mode.
#ifndef UBFIX
if (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvl] >= 140)
#else
if (gSaveBlock2Ptr->frontier.pyramidWinStreas[gSaveBlock2Ptr->frontier.lvlMode] >= 140)
#endif
{
id = (Random() % 17) + 15;
for (i = 0; i < NUM_STATS; i++)