From 41604ef9833b1d06539f71461613de646d9abe4f Mon Sep 17 00:00:00 2001 From: voloved <36523934+voloved@users.noreply.github.com> Date: Thu, 6 Apr 2023 09:58:33 -0400 Subject: [PATCH] Made GetPreEvolution as simple as can be --- ...to-Teach-Moves-that-Pre-Evolutions-Know.md | 22 ++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/Allow-Move-Relearner-to-Teach-Moves-that-Pre-Evolutions-Know.md b/Allow-Move-Relearner-to-Teach-Moves-that-Pre-Evolutions-Know.md index 8c56ab5..40bed29 100644 --- a/Allow-Move-Relearner-to-Teach-Moves-that-Pre-Evolutions-Know.md +++ b/Allow-Move-Relearner-to-Teach-Moves-that-Pre-Evolutions-Know.md @@ -38,25 +38,17 @@ EWRAM_DATA u8 gPlayerPartyCount = 0; } +static u16 GetPreEvolution(u16 species){ -+ int i, j, k; -+ u16 preEvolution = SPECIES_NONE; -+ bool8 found; -+ found = FALSE; -+ for (j = 1; j < NUM_SPECIES; j++) ++ int i, j; ++ ++ for (i = 1; i < NUM_SPECIES; i++) + { -+ for (k = 0; k < EVOS_PER_MON; k++) ++ for (j = 0; j < EVOS_PER_MON; j++) + { -+ if (gEvolutionTable[j][k].targetSpecies == species) -+ { -+ preEvolution= j; -+ found = TRUE; -+ break; -+ } ++ if (gEvolutionTable[i][j].targetSpecies == species) ++ return i; + } -+ if (found) -+ break; + } -+ return preEvolution; ++ return SPECIES_NONE; +} + u8 GetMoveRelearnerMoves(struct Pokemon *mon, u16 *moves)