|
|
|
@ -1,10 +1,20 @@
|
|
|
|
|
#include "magiceffects.hpp"
|
|
|
|
|
|
|
|
|
|
#include <cmath>
|
|
|
|
|
#include <stdexcept>
|
|
|
|
|
|
|
|
|
|
#include <components/esm/effectlist.hpp>
|
|
|
|
|
#include <components/esm/magiceffects.hpp>
|
|
|
|
|
|
|
|
|
|
namespace
|
|
|
|
|
{
|
|
|
|
|
// Round value to prevent precision issues
|
|
|
|
|
void truncate(float& value)
|
|
|
|
|
{
|
|
|
|
|
value = std::roundf(value * 1000.f) / 1000.f;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace MWMechanics
|
|
|
|
|
{
|
|
|
|
|
EffectKey::EffectKey() : mId (0), mArg (-1) {}
|
|
|
|
@ -74,6 +84,7 @@ namespace MWMechanics
|
|
|
|
|
{
|
|
|
|
|
mModifier += param.mModifier;
|
|
|
|
|
mBase += param.mBase;
|
|
|
|
|
truncate(mModifier);
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -81,6 +92,7 @@ namespace MWMechanics
|
|
|
|
|
{
|
|
|
|
|
mModifier -= param.mModifier;
|
|
|
|
|
mBase -= param.mBase;
|
|
|
|
|
truncate(mModifier);
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|