Partner fixes (#4422)

* Partner fixes

* Generalise TRAINER_PARTNER(PARTNER_NONE)
This commit is contained in:
Bassoonian 2024-04-22 10:20:37 +02:00 committed by GitHub
parent 9097f438f1
commit 6bde095ae8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View file

@ -168,14 +168,14 @@ static inline const u8 GetTrainerClassFromId(u16 trainerId)
static inline const u8 *GetTrainerClassNameFromId(u16 trainerId)
{
if (trainerId > TRAINER_PARTNER(PARTNER_NONE))
return gTrainerClasses[gBattlePartners[trainerId].trainerClass].name;
return gTrainerClasses[gBattlePartners[trainerId - TRAINER_PARTNER(PARTNER_NONE)].trainerClass].name;
return gTrainerClasses[GetTrainerClassFromId(trainerId)].name;
}
static inline const u8 *GetTrainerNameFromId(u16 trainerId)
{
if (trainerId > TRAINER_PARTNER(PARTNER_NONE))
return gBattlePartners[trainerId].trainerName;
return gBattlePartners[trainerId - TRAINER_PARTNER(PARTNER_NONE)].trainerName;
return gTrainers[SanitizeTrainerId(trainerId)].trainerName;
}

View file

@ -1435,7 +1435,7 @@ u8 GetFrontierOpponentClass(u16 trainerId)
}
else if (trainerId > TRAINER_PARTNER(PARTNER_NONE))
{
trainerClass = gBattlePartners[GetTrainerClassFromId(trainerId - TRAINER_PARTNER(PARTNER_NONE))].trainerClass;
trainerClass = gBattlePartners[trainerId - TRAINER_PARTNER(PARTNER_NONE)].trainerClass;
}
else if (trainerId < FRONTIER_TRAINERS_COUNT)
{