Skip to content

Commit 51c6301

Browse files
committed
Small changes
1 parent 2ce571f commit 51c6301

3 files changed

Lines changed: 8 additions & 14 deletions

File tree

Source/Attributes/Private/AttrModifier.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,19 @@ FAttrModifier::FAttrModifier(float Increment, float LastValueMultiplier, float B
3131

3232
void FAttrModifier::Apply(float& Value, float BaseValue) const
3333
{
34-
if (!FMath::IsNearlyZero(LastMultiplier))
35-
{
36-
Value *= 1.0f + LastMultiplier;
37-
}
34+
Value *= 1.0f + LastMultiplier;
35+
3836
if (!FMath::IsNearlyZero(BaseMultiplier))
3937
{
4038
Value += BaseMultiplier * BaseValue;
4139
}
4240
Value += Increment;
4341
}
4442

45-
void FAttrModifier::Apply(double& Value, int32 BaseValue) const
43+
void FAttrModifier::Apply(double& Value, double BaseValue) const
4644
{
47-
if (!FMath::IsNearlyZero(LastMultiplier))
48-
{
49-
Value *= 1.0 + LastMultiplier;
50-
}
45+
Value *= 1.0 + LastMultiplier;
46+
5147
if (!FMath::IsNearlyZero(BaseMultiplier))
5248
{
5349
Value += BaseMultiplier * BaseValue;

Source/Attributes/Private/Int32Attr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void FInt32Attr::InternalRefreshValue(FAttributeChangeInfo&& ChangeInfo)
3838
{
3939
for (const auto& Mod : Category.Modifiers)
4040
{
41-
Mod.Apply(TempValue, BaseValue);
41+
Mod.Apply(TempValue, double(BaseValue));
4242
}
4343
}
4444

Source/Attributes/Public/AttrModifier.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,9 @@ struct ATTRIBUTES_API FAttrModifier
7878
return *this;
7979
}
8080

81-
/** Apply changes to the value */
81+
/** Applies changes to value */
8282
void Apply(float& Value, float BaseValue) const;
83-
84-
/** Applies the modifier to the value. This version operates as double to avoid int32 precision lose */
85-
void Apply(double& Value, int32 BaseValue) const;
83+
void Apply(double& Value, double BaseValue) const;
8684

8785
/** Stack other modifiers values into this mod.
8886
* Now applying this modifier will be equivalent to applying all the others at the same time

0 commit comments

Comments
 (0)