diff --git a/src/utils/math.hpp b/src/utils/math.hpp index e9c1ed44f5f60..4198530f1256d 100644 --- a/src/utils/math.hpp +++ b/src/utils/math.hpp @@ -77,10 +77,10 @@ constexpr T modulo(T num, int mod, T min = 0) * round (base_damage * bonus / divisor) to the closest integer, * but up or down towards base_damage */ -constexpr int round_damage(int base_damage, int bonus, int divisor) { +constexpr int round_damage(double base_damage, int bonus, int divisor) { if (base_damage==0) return 0; const int rounding = divisor / 2 - (bonus < divisor || divisor==1 ? 0 : 1); - return std::max(1, (base_damage * bonus + rounding) / divisor); + return std::max(1, static_cast((base_damage * bonus + rounding) / divisor)); } template