diff options
Diffstat (limited to 'src/battle_setup.c')
-rw-r--r-- | src/battle_setup.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/battle_setup.c b/src/battle_setup.c index bc569dff7..b6e2faff0 100644 --- a/src/battle_setup.c +++ b/src/battle_setup.c @@ -1287,8 +1287,9 @@ s32 TrainerIdToRematchTableId(const struct TrainerEyeTrainer *trainers, u16 oppo for (i = 0; i < NUM_TRAINER_EYE_TRAINERS; i++) { - for (j = 0; j < 5 && trainers[i].opponentIDs[j] != 0; j++) + for (j = 0; j < 5; j++) { + if (trainers[i].opponentIDs[j] == 0) break; // one-line required to match with -g if (trainers[i].opponentIDs[j] == opponentId) return i; } @@ -1354,7 +1355,7 @@ bool8 IsFirstTrainerIdReadyForRematch(const struct TrainerEyeTrainer *trainers, { s32 trainerEyeIndex = FirstBattleTrainerIdToRematchTableId(trainers, opponentId); - if (trainerEyeIndex != -1 && trainerEyeIndex < 100 && gSaveBlock1.trainerRematches[trainerEyeIndex]) + if (trainerEyeIndex != -1 && trainerEyeIndex < MAX_REMATCH_ENTRIES && gSaveBlock1.trainerRematches[trainerEyeIndex]) return TRUE; else return FALSE; @@ -1364,7 +1365,7 @@ bool8 GetTrainerEyeRematchFlag(const struct TrainerEyeTrainer *trainers, u16 opp { s32 trainerEyeIndex = TrainerIdToRematchTableId(trainers, opponentId); - if (trainerEyeIndex != -1 && trainerEyeIndex < 100 && gSaveBlock1.trainerRematches[trainerEyeIndex]) + if (trainerEyeIndex != -1 && trainerEyeIndex < MAX_REMATCH_ENTRIES && gSaveBlock1.trainerRematches[trainerEyeIndex]) return TRUE; else return FALSE; |