From 9f44ebc5cd2b3088469f188c355db4fe905d299a Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Tue, 2 Apr 2019 03:27:05 -0400 Subject: [PATCH] Automatically calculate REMATCH_TABLE_ENTRIES Uses the standard C way of calculating the length of an enum. --- include/battle_setup.h | 1 - include/gym_leader_rematch.h | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/battle_setup.h b/include/battle_setup.h index e3faa5dcf..984c820bb 100644 --- a/include/battle_setup.h +++ b/include/battle_setup.h @@ -4,7 +4,6 @@ #include "gym_leader_rematch.h" #define REMATCHES_COUNT 5 -#define REMATCH_TABLE_ENTRIES 78 #define REMATCH_ELITE_FOUR_ENTRIES REMATCH_SIDNEY struct RematchTrainer diff --git a/include/gym_leader_rematch.h b/include/gym_leader_rematch.h index ed1143db5..778d7a1e8 100644 --- a/include/gym_leader_rematch.h +++ b/include/gym_leader_rematch.h @@ -81,7 +81,11 @@ enum { REMATCH_PHOEBE, REMATCH_GLACIA, REMATCH_DRAKE, - REMATCH_WALLACE + REMATCH_WALLACE, + + // The total number of rematch entries. This must be the last element + // in the enum. + REMATCH_TABLE_ENTRIES }; void UpdateGymLeaderRematch(void);