diff --git a/include/constants/battle.h b/include/constants/battle.h index d651dab189..bcfb34c45f 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -475,4 +475,7 @@ // For the second argument of GetMoveTarget, when no target override is needed #define NO_TARGET_OVERRIDE 0 +// Makes sure gWrappedStringIds and sTrappingMoves have the same size +#define TRAPPING_MOVES_COUNT 9 + #endif // GUARD_CONSTANTS_BATTLE_H diff --git a/src/battle_message.c b/src/battle_message.c index 8cf9a508b2..34d020188a 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -1562,7 +1562,7 @@ const u16 gFirstTurnOfTwoStringIds[] = }; // Index copied from move's index in sTrappingMoves -const u16 gWrappedStringIds[] = +const u16 gWrappedStringIds[TRAPPING_MOVES_COUNT] = { STRINGID_PKMNSQUEEZEDBYBIND, // MOVE_BIND STRINGID_PKMNWRAPPEDBY, // MOVE_WRAP diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 15915c71a6..4abaf5adbd 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -279,9 +279,9 @@ static const s32 sExperienceScalingFactors[] = 159767, }; -static const u16 sTrappingMoves[] = +static const u16 sTrappingMoves[TRAPPING_MOVES_COUNT] = { - MOVE_BIND, MOVE_WRAP, MOVE_FIRE_SPIN, MOVE_CLAMP, MOVE_WHIRLPOOL, MOVE_SAND_TOMB, MOVE_MAGMA_STORM, MOVE_INFESTATION, MOVE_SNAP_TRAP, 0xFFFF + MOVE_BIND, MOVE_WRAP, MOVE_FIRE_SPIN, MOVE_CLAMP, MOVE_WHIRLPOOL, MOVE_SAND_TOMB, MOVE_MAGMA_STORM, MOVE_INFESTATION, MOVE_SNAP_TRAP, }; #define STAT_CHANGE_WORKED 0 @@ -3037,10 +3037,8 @@ void SetMoveEffect(bool32 primary, u32 certain) BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = sMoveEffectBS_Ptrs[gBattleScripting.moveEffect]; - for (gBattleCommunication[MULTISTRING_CHOOSER] = 0; ; gBattleCommunication[MULTISTRING_CHOOSER]++) + for (gBattleCommunication[MULTISTRING_CHOOSER] = 0; gBattleCommunication[MULTISTRING_CHOOSER] < TRAPPING_MOVES_COUNT; gBattleCommunication[MULTISTRING_CHOOSER]++) { - if (gBattleCommunication[MULTISTRING_CHOOSER] > ARRAY_COUNT(sTrappingMoves) - 1) - break; if (sTrappingMoves[gBattleCommunication[MULTISTRING_CHOOSER]] == gCurrentMove) break; }