mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-27 05:43:51 +01:00
Note overflow in ModifyStatByNature
This commit is contained in:
parent
48e54ae387
commit
a6847ca1d9
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user