diff options
author | GriffinR <griffin.g.richards@gmail.com> | 2021-08-02 14:08:10 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-02 14:08:10 -0400 |
commit | bd5cf070597e9c9d175777832859ed0c64fe7760 (patch) | |
tree | 4dda9e759cbb4cf0c061c24a83832c59277f7d53 /src/apprentice.c | |
parent | 06b909bcd80e5b3f882273a317ac957cd57f07a5 (diff) | |
parent | d391486247cc9f29d85787d6711f7cb993cf6585 (diff) |
Merge branch 'master' into doc-playerpc
Diffstat (limited to 'src/apprentice.c')
-rw-r--r-- | src/apprentice.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/apprentice.c b/src/apprentice.c index f93a3e30b..00157dc1a 100644 --- a/src/apprentice.c +++ b/src/apprentice.c @@ -30,7 +30,7 @@ #include "constants/trainers.h" #include "constants/moves.h" -/* Summary of Apprentice, because (as of writing at least) its not very well documented online +/* Summary of Apprentice, because (as of writing at least) it's not very well documented online * * ## Basic info * In the Battle Tower lobby there is an NPC which asks to be taught by the player @@ -1107,17 +1107,24 @@ static void TrySetApprenticeHeldItem(void) if (PLAYER_APPRENTICE.questionsAnswered < NUM_WHICH_MON_QUESTIONS) return; + + count = 0; + for (j = 0; j < APPRENTICE_MAX_QUESTIONS; j++) + { + if (PLAYER_APPRENTICE.questions[j].questionId == QUESTION_ID_WIN_SPEECH) + break; + count++; + } - for (count = 0, j = 0; j < APPRENTICE_MAX_QUESTIONS && PLAYER_APPRENTICE.questions[j].questionId != QUESTION_ID_WIN_SPEECH; count++, j++) - ; - - // Make sure the item hasnt already been suggested in previous questions - for (i = 0; i < count && i < CURRENT_QUESTION_NUM; i++) + // Make sure the item hasn't already been suggested in previous questions + for (i = 0; i < count; i++) { - do {} while(0); - if (PLAYER_APPRENTICE.questions[i].questionId == QUESTION_ID_WHAT_ITEM - && PLAYER_APPRENTICE.questions[i].suggestedChange - && PLAYER_APPRENTICE.questions[i].data == gSpecialVar_0x8005) + if (i >= CURRENT_QUESTION_NUM) + break; + if (PLAYER_APPRENTICE.questions[i].questionId != QUESTION_ID_WHAT_ITEM || + PLAYER_APPRENTICE.questions[i].suggestedChange == 0) + continue; + if (PLAYER_APPRENTICE.questions[i].data == gSpecialVar_0x8005) { PLAYER_APPRENTICE.questions[CURRENT_QUESTION_NUM].suggestedChange = FALSE; PLAYER_APPRENTICE.questions[CURRENT_QUESTION_NUM].data = gSpecialVar_0x8005; |