summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--src/pokemon.c4
2 files changed, 3 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index 2a1300ab3..15cc865df 100644
--- a/.gitignore
+++ b/.gitignore
@@ -30,3 +30,4 @@ build/
.idea/
porymap.project.cfg
.vscode/
+*.a
diff --git a/src/pokemon.c b/src/pokemon.c
index da659b10d..55f9a93f3 100644
--- a/src/pokemon.c
+++ b/src/pokemon.c
@@ -5724,9 +5724,9 @@ u16 ModifyStatByNature(u8 nature, u16 n, u8 statIndex)
switch (gNatureStatTable[nature][statIndex - 1])
{
case 1:
- return (u16)(n * 110) / 100;
+ return (u16)(n * 110) / 100; // NOTE: will overflow for n > 595 because the intermediate value is cast to u16 before the division. Fix by removing (u16) cast
case -1:
- return (u16)(n * 90) / 100;
+ return (u16)(n * 90) / 100; // NOTE: will overflow for n > 728, see above
}
return n;