mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-26 22:57:00 +02:00
Fix floating point rounding for 5 attack points and unupgraded nix
This commit is contained in:
parent
675f9b11fa
commit
dbba1164ef
@ -9,6 +9,9 @@
|
||||
*/
|
||||
|
||||
#include "StdInc.h"
|
||||
|
||||
#include <cfenv>
|
||||
|
||||
#include "DamageCalculator.h"
|
||||
#include "CBattleInfoCallback.h"
|
||||
#include "Unit.h"
|
||||
@ -133,7 +136,10 @@ int DamageCalculator::getActorAttackIgnored() const
|
||||
|
||||
if(multAttackReduction > 0)
|
||||
{
|
||||
int reduction = std::round(multAttackReduction * getActorAttackBase());
|
||||
int defaultRoundingMode = std::fegetround();
|
||||
std::fesetround(FE_TOWARDZERO);
|
||||
int reduction = std::nearbyint(multAttackReduction * getActorAttackBase());
|
||||
std::fesetround(defaultRoundingMode);
|
||||
return -std::min(reduction,getActorAttackBase());
|
||||
}
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user