From e605ffba539fd54f2a5d105493c2943a6bdd91c1 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Wed, 4 Dec 2024 18:22:16 -0300 Subject: [PATCH] Fix recorded battle link player loops (#2071) --- src/recorded_battle.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/recorded_battle.c b/src/recorded_battle.c index 42866c723b..ebd2a5800f 100644 --- a/src/recorded_battle.c +++ b/src/recorded_battle.c @@ -35,13 +35,13 @@ struct RecordedBattleSave { struct Pokemon playerParty[PARTY_SIZE]; struct Pokemon opponentParty[PARTY_SIZE]; - u8 playersName[MAX_BATTLERS_COUNT][PLAYER_NAME_LENGTH + 1]; - u8 playersGender[MAX_BATTLERS_COUNT]; - u32 playersTrainerId[MAX_BATTLERS_COUNT]; - u8 playersLanguage[MAX_BATTLERS_COUNT]; + u8 playersName[MAX_LINK_PLAYERS][PLAYER_NAME_LENGTH + 1]; + u8 playersGender[MAX_LINK_PLAYERS]; + u32 playersTrainerId[MAX_LINK_PLAYERS]; + u8 playersLanguage[MAX_LINK_PLAYERS]; u32 rngSeed; u32 battleFlags; - u8 playersBattlers[MAX_BATTLERS_COUNT]; + u8 playersBattlers[MAX_LINK_PLAYERS]; u16 opponentA; u16 opponentB; u16 partnerId; @@ -85,7 +85,7 @@ EWRAM_DATA static u32 sAI_Scripts = 0; EWRAM_DATA static struct Pokemon sSavedPlayerParty[PARTY_SIZE] = {0}; EWRAM_DATA static struct Pokemon sSavedOpponentParty[PARTY_SIZE] = {0}; EWRAM_DATA static u16 sPlayerMonMoves[MAX_BATTLERS_COUNT / 2][MAX_MON_MOVES] = {0}; -EWRAM_DATA static struct PlayerInfo sPlayers[MAX_BATTLERS_COUNT] = {0}; +EWRAM_DATA static struct PlayerInfo sPlayers[MAX_LINK_PLAYERS] = {0}; EWRAM_DATA static bool8 sIsPlaybackFinished = 0; EWRAM_DATA static u8 sRecordMixFriendName[PLAYER_NAME_LENGTH + 1] = {0}; EWRAM_DATA static u8 sRecordMixFriendClass = 0; @@ -148,7 +148,7 @@ void RecordedBattle_SetTrainerInfo(void) gRecordedBattleMultiplayerId = GetMultiplayerId(); linkPlayersCount = GetLinkPlayerCount(); - for (i = 0; i < MAX_BATTLERS_COUNT; i++) + for (i = 0; i < MAX_LINK_PLAYERS; i++) { sPlayers[i].trainerId = gLinkPlayers[i].trainerId; sPlayers[i].gender = gLinkPlayers[i].gender; @@ -333,7 +333,7 @@ bool32 MoveRecordedBattleToSaveData(void) battleSave->opponentParty[i] = sSavedOpponentParty[i]; } - for (i = 0; i < MAX_BATTLERS_COUNT; i++) + for (i = 0; i < MAX_LINK_PLAYERS; i++) { for (j = 0; j < PLAYER_NAME_LENGTH + 1; j++) battleSave->playersName[i][j] = sPlayers[i].name[j]; @@ -535,7 +535,7 @@ static void SetVariablesForRecordedBattle(struct RecordedBattleSave *src) gEnemyParty[i] = src->opponentParty[i]; } - for (i = 0; i < MAX_BATTLERS_COUNT; i++) + for (i = 0; i < MAX_LINK_PLAYERS; i++) { for (var = FALSE, j = 0; j < PLAYER_NAME_LENGTH + 1; j++) {