diff options
author | Kurausukun <lord.uber1@gmail.com> | 2021-05-31 00:19:26 -0400 |
---|---|---|
committer | huderlem <huderlem@gmail.com> | 2021-05-31 08:20:46 -0500 |
commit | 2bbaf71998337cba3c912143302f816b4116e851 (patch) | |
tree | 9606dd8751182d185d5903494f48002775dda2c8 /src | |
parent | 2705f2e5f44980f368d30845215e28ae5ea5c595 (diff) |
[LEAK-INFORMED] fix CreateShedinja fakematch
info: the header change is required. accesses to the struct need to be
treated as non-const, even though the array must be const. thanks to
jiang for figuring this out.
Diffstat (limited to 'src')
-rw-r--r-- | src/daycare.c | 2 | ||||
-rw-r--r-- | src/evolution_scene.c | 12 |
2 files changed, 6 insertions, 8 deletions
diff --git a/src/daycare.c b/src/daycare.c index 34b864981..14053217d 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -23,6 +23,8 @@ #include "constants/moves.h" #include "constants/region_map_sections.h" +extern struct Evolution gEvolutionTable[][EVOS_PER_MON]; + // this file's functions static void ClearDaycareMonMail(struct DaycareMail *mail); static void SetInitialEggData(struct Pokemon *mon, u16 species, struct DayCare *daycare); diff --git a/src/evolution_scene.c b/src/evolution_scene.c index 39e917161..08f816f4f 100644 --- a/src/evolution_scene.c +++ b/src/evolution_scene.c @@ -34,6 +34,8 @@ #include "constants/rgb.h" #include "constants/items.h" +extern struct Evolution gEvolutionTable[][EVOS_PER_MON]; + struct EvoInfo { u8 preEvoSpriteId; @@ -550,8 +552,6 @@ static void CreateShedinja(u16 preEvoSpecies, struct Pokemon* mon) { s32 i; struct Pokemon* shedinja = &gPlayerParty[gPlayerPartyCount]; - const struct Evolution *evos; - const struct Evolution *evos2; CopyMon(&gPlayerParty[gPlayerPartyCount], mon, sizeof(struct Pokemon)); SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_SPECIES, &gEvolutionTable[preEvoSpecies][1].targetSpecies); @@ -572,12 +572,8 @@ static void CreateShedinja(u16 preEvoSpecies, struct Pokemon* mon) CalculateMonStats(&gPlayerParty[gPlayerPartyCount]); CalculatePlayerPartyCount(); - // can't match it otherwise, ehh - evos2 = gEvolutionTable[0]; - evos = evos2 + EVOS_PER_MON * preEvoSpecies; - - GetSetPokedexFlag(SpeciesToNationalPokedexNum(evos[1].targetSpecies), FLAG_SET_SEEN); - GetSetPokedexFlag(SpeciesToNationalPokedexNum(evos[1].targetSpecies), FLAG_SET_CAUGHT); + GetSetPokedexFlag(SpeciesToNationalPokedexNum(gEvolutionTable[preEvoSpecies][1].targetSpecies), FLAG_SET_SEEN); + GetSetPokedexFlag(SpeciesToNationalPokedexNum(gEvolutionTable[preEvoSpecies][1].targetSpecies), FLAG_SET_CAUGHT); if (GetMonData(shedinja, MON_DATA_SPECIES) == SPECIES_SHEDINJA && GetMonData(shedinja, MON_DATA_LANGUAGE) == LANGUAGE_JAPANESE |