diff options
author | melthelesbian <44884535+melthelesbian@users.noreply.github.com> | 2018-12-25 12:50:15 -0500 |
---|---|---|
committer | Marcus Huderle <huderlem@gmail.com> | 2018-12-25 11:50:15 -0600 |
commit | 2dd706ca5410d98ad214ceff7026d6db276f4d5a (patch) | |
tree | 20d184fb4f7e48d965c6c88b39dfd7fc11d3dd86 /src/apprentice.c | |
parent | dcbc8db6a32e70651163a132950d486d93a58254 (diff) |
use max mon moves constant where able (#480)
* use max mon moves constant where able
* fix errors in script commands file
* fix more errors
Diffstat (limited to 'src/apprentice.c')
-rw-r--r-- | src/apprentice.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/apprentice.c b/src/apprentice.c index ec8fea27b..5d636d05d 100644 --- a/src/apprentice.c +++ b/src/apprentice.c @@ -1,5 +1,6 @@ #include "global.h" #include "apprentice.h" +#include "battle.h" #include "battle_tower.h" #include "data2.h" #include "event_data.h" @@ -1298,7 +1299,7 @@ static u16 sub_819FF98(u8 arg0) knownMovesCount = j; i = 0; - while (i < 5) + while (i <= MAX_MON_MOVES) { if (Random() % 2 == 0 || var_24 == TRUE) { @@ -1317,7 +1318,7 @@ static u16 sub_819FF98(u8 arg0) if (knownMovesCount < 5) j = 0; else - j = knownMovesCount - 4; + j = knownMovesCount - MAX_MON_MOVES; for (; j < knownMovesCount; j++) { @@ -1331,7 +1332,7 @@ static u16 sub_819FF98(u8 arg0) } else { - if (knownMovesCount < 5) + if (knownMovesCount <= MAX_MON_MOVES) { var_24 = TRUE; continue; @@ -1340,10 +1341,10 @@ static u16 sub_819FF98(u8 arg0) { do { - u8 learnsetId = Random() % (knownMovesCount - 4); + u8 learnsetId = Random() % (knownMovesCount - MAX_MON_MOVES); moveId = learnset[learnsetId] & 0x1FF; valid = TRUE; - for (j = knownMovesCount - 4; j < knownMovesCount; j++) + for (j = knownMovesCount - MAX_MON_MOVES; j < knownMovesCount; j++) { if ((learnset[j] & 0x1FF) == moveId) { @@ -1400,8 +1401,8 @@ static void GetLatestLearnedMoves(u16 species, u16 *moves) } knownMovesCount = i; - if (knownMovesCount > 4) - knownMovesCount = 4; + if (knownMovesCount > MAX_MON_MOVES) + knownMovesCount = MAX_MON_MOVES; for (j = 0; j < knownMovesCount; j++) moves[j] = learnset[(i - 1) - j] & 0x1FF; @@ -1447,7 +1448,7 @@ static void sub_81A0390(u8 arg0) { gSaveBlock2Ptr->apprentices[0].party[i].species = 0; gSaveBlock2Ptr->apprentices[0].party[i].item = 0; - for (j = 0; j < 4; j++) + for (j = 0; j < MAX_MON_MOVES; j++) gSaveBlock2Ptr->apprentices[0].party[i].moves[j] = 0; } |