diff options
author | nullableVoidPtr <30564701+nullableVoidPtr@users.noreply.github.com> | 2018-11-29 19:24:28 +0800 |
---|---|---|
committer | nullableVoidPtr <30564701+nullableVoidPtr@users.noreply.github.com> | 2018-12-06 09:44:08 +0800 |
commit | 3909b6408c0125fe311d49a3029a2806993615f7 (patch) | |
tree | a02365a6eb268dce08941968e11e319f3a7fe080 /src/battle_ai_script_commands.c | |
parent | 1b33ad6c26fa83aa7b77055ddde59c61df03d0e4 (diff) |
Fix alloc.c as per #386, define INVALID_ constants and rename malloc to alloc as per #325
Some of the INVALID_ are likely erroneously placed, due to lack of documentation
Diffstat (limited to 'src/battle_ai_script_commands.c')
-rw-r--r-- | src/battle_ai_script_commands.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/battle_ai_script_commands.c b/src/battle_ai_script_commands.c index 3e7064eb5..e6c089b1b 100644 --- a/src/battle_ai_script_commands.c +++ b/src/battle_ai_script_commands.c @@ -276,7 +276,7 @@ static const u16 sDiscouragedPowerfulMoveEffects[] = EFFECT_SUPERPOWER, EFFECT_ERUPTION, EFFECT_OVERHEAT, - 0xFFFF + INVALID_U16 }; // code @@ -463,8 +463,8 @@ static u8 ChooseMoveOrAction_Doubles(void) { if (i == sBattler_AI || gBattleMons[i].hp == 0) { - actionOrMoveIndex[i] = -1; - bestMovePointsForTarget[i] = -1; + actionOrMoveIndex[i] = INVALID_U8; + bestMovePointsForTarget[i] = INVALID_S16 ; } else { @@ -530,7 +530,7 @@ static u8 ChooseMoveOrAction_Doubles(void) // Don't use a move against ally if it has less than 100 points. if (i == (sBattler_AI ^ BIT_FLANK) && bestMovePointsForTarget[i] < 100) { - bestMovePointsForTarget[i] = -1; + bestMovePointsForTarget[i] = INVALID_S16; mostViableMovesScores[0] = mostViableMovesScores[0]; // Needed to match. } } @@ -1003,7 +1003,7 @@ static void BattleAICmd_if_in_bytes(void) { const u8 *ptr = T1_READ_PTR(gAIScriptPtr + 1); - while (*ptr != 0xFF) + while (*ptr != INVALID_U8) { if (AI_THINKING_STRUCT->funcResult == *ptr) { @@ -1019,7 +1019,7 @@ static void BattleAICmd_if_not_in_bytes(void) { const u8 *ptr = T1_READ_PTR(gAIScriptPtr + 1); - while (*ptr != 0xFF) + while (*ptr != INVALID_U8) { if (AI_THINKING_STRUCT->funcResult == *ptr) { @@ -1035,7 +1035,7 @@ static void BattleAICmd_if_in_hwords(void) { const u16 *ptr = (const u16 *)T1_READ_PTR(gAIScriptPtr + 1); - while (*ptr != 0xFFFF) + while (*ptr != INVALID_U16) { if (AI_THINKING_STRUCT->funcResult == *ptr) { @@ -1051,7 +1051,7 @@ static void BattleAICmd_if_not_in_hwords(void) { const u16 *ptr = (const u16 *)T1_READ_PTR(gAIScriptPtr + 1); - while (*ptr != 0xFFFF) + while (*ptr != INVALID_U16) { if (AI_THINKING_STRUCT->funcResult == *ptr) { @@ -1167,14 +1167,14 @@ static void BattleAICmd_get_how_powerful_move_is(void) s32 i, checkedMove; s32 moveDmgs[4]; - for (i = 0; sDiscouragedPowerfulMoveEffects[i] != 0xFFFF; i++) + for (i = 0; sDiscouragedPowerfulMoveEffects[i] != INVALID_U16; i++) { if (gBattleMoves[AI_THINKING_STRUCT->moveConsidered].effect == sDiscouragedPowerfulMoveEffects[i]) break; } if (gBattleMoves[AI_THINKING_STRUCT->moveConsidered].power > 1 - && sDiscouragedPowerfulMoveEffects[i] == 0xFFFF) + && sDiscouragedPowerfulMoveEffects[i] == INVALID_U16) { gDynamicBasePower = 0; *(&gBattleStruct->dynamicMoveType) = 0; @@ -1184,14 +1184,14 @@ static void BattleAICmd_get_how_powerful_move_is(void) for (checkedMove = 0; checkedMove < 4; checkedMove++) { - for (i = 0; sDiscouragedPowerfulMoveEffects[i] != 0xFFFF; i++) + for (i = 0; sDiscouragedPowerfulMoveEffects[i] != INVALID_U16; i++) { if (gBattleMoves[gBattleMons[sBattler_AI].moves[checkedMove]].effect == sDiscouragedPowerfulMoveEffects[i]) break; } if (gBattleMons[sBattler_AI].moves[checkedMove] != MOVE_NONE - && sDiscouragedPowerfulMoveEffects[i] == 0xFFFF + && sDiscouragedPowerfulMoveEffects[i] == INVALID_U16 && gBattleMoves[gBattleMons[sBattler_AI].moves[checkedMove]].power > 1) { gCurrentMove = gBattleMons[sBattler_AI].moves[checkedMove]; |