diff options
Diffstat (limited to 'src/battle_ai_script_commands.c')
-rw-r--r-- | src/battle_ai_script_commands.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/battle_ai_script_commands.c b/src/battle_ai_script_commands.c index 5aef7a04f..4adb39a5d 100644 --- a/src/battle_ai_script_commands.c +++ b/src/battle_ai_script_commands.c @@ -14,7 +14,6 @@ #include "constants/battle_ai.h" #include "constants/battle_move_effects.h" #include "constants/moves.h" -#include "constants/species.h" #define AI_ACTION_DONE 0x0001 #define AI_ACTION_FLEE 0x0002 @@ -451,7 +450,16 @@ static u8 ChooseMoveOrAction_Doubles(void) { s32 i; s32 j; +#ifndef BUGFIX s32 scriptsToRun; +#else + // the value assigned to this is a u32 (aiFlags) + // this becomes relevant because aiFlags can have bit 31 set + // and scriptsToRun is shifted + // this never happens in the vanilla game because bit 31 is + // only set when it's the first battle + u32 scriptsToRun; +#endif s16 bestMovePointsForTarget[MAX_BATTLERS_COUNT]; s8 mostViableTargetsArray[MAX_BATTLERS_COUNT]; u8 actionOrMoveIndex[MAX_BATTLERS_COUNT]; @@ -1299,7 +1307,7 @@ static void Cmd_count_usable_party_mons(void) if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) { - u8 position; + u32 position; battlerOnField1 = gBattlerPartyIndexes[battlerId]; position = GetBattlerPosition(battlerId) ^ BIT_FLANK; battlerOnField2 = gBattlerPartyIndexes[GetBattlerAtPosition(position)]; |