Add a function to wrap percentage calculations

This should help avoid issues from integer overflow (which is technically undefined behaviour)
while also allowing such issues to be addressed centrally if they still exist.
This commit is contained in:
2023-01-21 17:41:33 -05:00
parent 7b4df6edf8
commit 4c6296612d
7 changed files with 18 additions and 19 deletions

View File

@@ -25,6 +25,7 @@ short get_ran(short times, short min, short max);
short max(short a,short b);
short min(short a,short b);
short minmax(short min,short max,short k);
int percent(int value, int percentage);
short gcd(short a, short b);
sf::Time time_in_ticks(int ticks);