diff --git a/src/dungeon_leader.c b/src/dungeon_leader.c index 9bd40709c..5bff54220 100644 --- a/src/dungeon_leader.c +++ b/src/dungeon_leader.c @@ -11,8 +11,8 @@ struct DungeonEntity* GetLeaderEntity() struct DungeonEntity *leader = gLeaderPokemon; if (leader == NULL) { - s32 i = 0; - do + s32 i; + for (i = 0; i < MAX_TEAM_MEMBERS; i++) { struct DungeonEntity *currentPokemon = gDungeonGlobalData->teamPokemon[i]; if (EntityExists(currentPokemon) && currentPokemon->entityData->isLeader) @@ -20,7 +20,7 @@ struct DungeonEntity* GetLeaderEntity() gLeaderPokemon = currentPokemon; return currentPokemon; } - } while (++i < MAX_TEAM_MEMBERS); + } return NULL; } return leader;