summaryrefslogtreecommitdiff
path: root/src/battle_ai_script_commands.c
diff options
context:
space:
mode:
authorKurausukun <lord.uber1@gmail.com>2020-12-10 23:30:52 -0500
committerKurausukun <lord.uber1@gmail.com>2020-12-10 23:30:52 -0500
commit58976ebaa8d73d174940f622ec36f22bcd2fd8a2 (patch)
treec27ab24ed83fdb16654b5814d681af487b119601 /src/battle_ai_script_commands.c
parent32ae13f9b66ab1b01146e5746e9350f97f055526 (diff)
parent8d29f65c6c7f34aa53ae2e7ae3e4f34a95025602 (diff)
Merge remote-tracking branch 'upstream/master' into berry_crush
Diffstat (limited to 'src/battle_ai_script_commands.c')
-rw-r--r--src/battle_ai_script_commands.c12
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)];