From ff94d49a45ef605cfaed1268aa5a230958e25cd9 Mon Sep 17 00:00:00 2001 From: Kurausukun Date: Sat, 3 Jul 2021 17:18:41 -0400 Subject: add SAFE_DIV macro and usages --- src/battle_script_commands.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/battle_script_commands.c') diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index ee9251017..c6ab568ff 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -3108,7 +3108,7 @@ static void atk23_getexp(void) calculatedExp = gBaseStats[gBattleMons[gBattlerFainted].species].expYield * gBattleMons[gBattlerFainted].level / 7; if (viaExpShare) // at least one mon is getting exp via exp share { - *exp = calculatedExp / 2 / viaSentIn; + *exp = SAFE_DIV(calculatedExp / 2, viaSentIn); if (*exp == 0) *exp = 1; gExpShareExp = calculatedExp / 2 / viaExpShare; @@ -3117,7 +3117,7 @@ static void atk23_getexp(void) } else { - *exp = calculatedExp / viaSentIn; + *exp = SAFE_DIV(calculatedExp, viaSentIn); if (*exp == 0) *exp = 1; gExpShareExp = 0; -- cgit v1.2.3