fix battle_dome goto

This commit is contained in:
Kurausukun 2021-05-09 00:31:39 -04:00 committed by huderlem
parent dbc1b9aacf
commit f0453871a2

View File

@ -5211,40 +5211,38 @@ static u16 GetWinningMove(int winnerTournamentId, int loserTournamentId, u8 roun
}
j = bestId;
goto LABEL;
while (j != 0)
do
{
for (j = 0, k = 0; k < MAX_MON_MOVES * FRONTIER_PARTY_SIZE; k++)
for (i = 0; i < roundId - 1; i++)
{
if (bestScore < moveScores[k])
{
j = k;
bestScore = moveScores[k];
}
else if (bestScore == moveScores[k] && moveIds[j] < moveIds[k])
{
j = k;
}
}
if (i == roundId - 1)
break;
LABEL:
{
for (i = 0; i < roundId - 1; i++)
{
if (gSaveBlock2Ptr->frontier.domeWinningMoves[sub_81953E8(winnerTournamentId, i)] == moveIds[j])
break;
}
if (i == roundId - 1)
if (gSaveBlock2Ptr->frontier.domeWinningMoves[sub_81953E8(winnerTournamentId, i)] == moveIds[j])
break;
}
if (i != roundId - 1)
{
moveScores[j] = 0;
bestScore = 0;
j = 0;
for (k = 0; k < MAX_MON_MOVES * FRONTIER_PARTY_SIZE; k++)
j += moveScores[k];
if (j == 0)
break;
j = 0;
for (k = 0; k < MAX_MON_MOVES * FRONTIER_PARTY_SIZE; k++)
{
if (bestScore < moveScores[k])
{
j = k;
bestScore = moveScores[k];
}
else if (bestScore == moveScores[k] && moveIds[j] < moveIds[k]) // Yes, these conditions are redundant
{
j = k;
bestScore = moveScores[k];
}
}
}
}
} while (i != roundId - 1);
if (moveScores[j] == 0)
j = bestId;