summaryrefslogtreecommitdiff
path: root/src/battle_ai_script_commands.c
diff options
context:
space:
mode:
authorluckytyphlosion <10688458+luckytyphlosion@users.noreply.github.com>2020-11-07 18:21:17 -0500
committerluckytyphlosion <10688458+luckytyphlosion@users.noreply.github.com>2020-11-07 18:21:17 -0500
commit4b748d32ccd7c35716ea7c1b3267b0b0ac53bca4 (patch)
tree915b28fa891582a29e3c73c9359db122927501bf /src/battle_ai_script_commands.c
parenta29b18ed2f27c2991b0894a69fa04738ba9522ca (diff)
Bugfix for ChooseMoveOrAction_Doubles.
Diffstat (limited to 'src/battle_ai_script_commands.c')
-rw-r--r--src/battle_ai_script_commands.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/battle_ai_script_commands.c b/src/battle_ai_script_commands.c
index 4185f8017..2423cfe37 100644
--- a/src/battle_ai_script_commands.c
+++ b/src/battle_ai_script_commands.c
@@ -450,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];