mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Fix handling of bonuses with negative values
This commit is contained in:
@@ -70,7 +70,10 @@ int BonusList::totalValue(int baseValue) const
|
||||
};
|
||||
|
||||
auto applyPercentageRoundUp = [](int base, int percent) -> int {
|
||||
return (static_cast<int64_t>(base) * (100 + percent) + 99) / 100;
|
||||
if (base >= 0)
|
||||
return (static_cast<int64_t>(base) * (100 + percent) + 99) / 100;
|
||||
else
|
||||
return (static_cast<int64_t>(base) * (100 + percent) - 99) / 100;
|
||||
};
|
||||
|
||||
auto applyPercentageRoundDown = [](int base, int percent) -> int {
|
||||
|
||||
Reference in New Issue
Block a user