From d0ba200ec5809d0da30c16df693f76be2b483889 Mon Sep 17 00:00:00 2001 From: laserXdolphin <107103137+laserXdolphin@users.noreply.github.com> Date: Thu, 29 Aug 2024 16:42:57 +0200 Subject: [PATCH] Fixed "money may be used uninitialized" warning --- src/battle_script_commands.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 7e3e89da7575..8b3697ba4dee 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -7754,11 +7754,14 @@ static void Cmd_getmoneyreward(void) u32 money; u8 sPartyLevel = 1; + u8 b_buff_number = 5; if (gBattleOutcome == B_OUTCOME_WON) { if (VarGet(gSpecialVar_0x8003) == 1) { + money = gSpecialVar_0x8004; + b_buff_number = 3; GiveFrontierBattlePoints(); } else{ @@ -7791,12 +7794,11 @@ static void Cmd_getmoneyreward(void) if (VarGet(gSpecialVar_0x8003) == 1) { - PREPARE_WORD_NUMBER_BUFFER(gBattleTextBuff1, 3, gSpecialVar_0x8004); gSpecialVar_0x8003 = 0; - gSpecialVar_0x8004 = 0;} - else{ - PREPARE_WORD_NUMBER_BUFFER(gBattleTextBuff1, 5, money); + gSpecialVar_0x8004 = 0; } + + PREPARE_WORD_NUMBER_BUFFER(gBattleTextBuff1, b_buff_number, money); gBattlescriptCurrInstr = cmd->nextInstr; }