Skip to content

Commit

Permalink
Creature: Try to make power rounding accurate
Browse files Browse the repository at this point in the history
  • Loading branch information
killerwife committed Aug 27, 2024
1 parent 9186c69 commit e3c2948
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/game/Entities/StatSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ void Unit::UpdateMaxPower(Powers power)
value += GetModifierValue(unitMod, TOTAL_VALUE) + bonusPower;
value *= GetModifierValue(unitMod, TOTAL_PCT);

SetMaxPower(power, uint32(value));
SetMaxPower(power, uint32(std::ceilf(value)));
}

void Player::ApplyFeralAPBonus(int32 amount, bool apply)
Expand Down Expand Up @@ -1130,7 +1130,7 @@ void Pet::UpdateMaxPower(Powers power)
value += GetModifierValue(unitMod, TOTAL_VALUE) + std::max((addValue - 20) * 15 + 20, 0.f);
value *= GetModifierValue(unitMod, TOTAL_PCT);

SetMaxPower(power, uint32(value));
SetMaxPower(power, uint32(std::ceilf(value)));
}

void Pet::UpdateAttackPowerAndDamage(bool ranged)
Expand Down

4 comments on commit e3c2948

@kelbren
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am currently using gcc 13.1 (linux) and get a compiler error about ceilf not being part of std.
If I remove the std:: it compiles correctly. Just a note if anyone else has this issue.

@insunaa
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's missing an

#include <cmath>

@kelbren
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately that didn't work, I still get the same error message.

@insunaa
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I checked it's a compiler bug that was fixed in gcc 13.3 if I'm reading things right https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79700
an alternative would be to use std::ceil or to update/switch the compiler

Please sign in to comment.