1- // Copyright 2015-2020 Piperift. All Rights Reserved.
1+ // Copyright 2015-2023 Piperift. All Rights Reserved.
22
33#include " BaseAttr.h"
4+
45#include " AttributesModule.h"
56
67
7- uint32 FBaseAttr::IdCount{ 0 };
8+ uint32 FBaseAttr::IdCount{0 };
89
910
1011void FBaseAttr::AddModifier (const FAttrModifier& Modifier, const FAttrCategory& Category)
@@ -18,31 +19,30 @@ void FBaseAttr::AddModifier(const FAttrModifier& Modifier, const FAttrCategory&
1819 {
1920 BaseModifiers.Add (Modifier);
2021 }
21- else if (!Category.IsNone ())
22+ else if (!Category.IsNone ())
2223 {
2324 int32 Index = CategoryMods.IndexOfByKey (Category);
2425 if (Index == INDEX_NONE)
2526 {
2627 // Add category if non existent
27- Index = CategoryMods.HeapPush ({ Category });
28+ Index = CategoryMods.HeapPush ({Category});
2829 }
2930
3031 CategoryMods[Index].Modifiers .Add (Modifier);
3132 }
3233 else
3334 {
34- UE_LOG (LogAttributes, Warning, TEXT (" Attributes: tried to add a modifier to the unexisting category '%s'" ), *Category.Name .ToString ());
35+ UE_LOG (LogAttributes, Warning,
36+ TEXT (" Attributes: tried to add a modifier to the unexisting category '%s'" ),
37+ *Category.Name .ToString ());
3538 return ;
3639 }
3740
38- InternalRefreshValue ({
39- EAttributeOperation::AddedMod,
40- Modifier,
41- Category
42- });
41+ InternalRefreshValue ({EAttributeOperation::AddedMod, Modifier, Category});
4342}
4443
45- bool FBaseAttr::RemoveModifier (const FAttrModifier& Modifier, const FAttrCategory& Category, bool bRemoveFromAllCategories)
44+ bool FBaseAttr::RemoveModifier (
45+ const FAttrModifier& Modifier, const FAttrCategory& Category, bool bRemoveFromAllCategories)
4646{
4747 bool bChanged = false ;
4848
@@ -62,7 +62,7 @@ bool FBaseAttr::RemoveModifier(const FAttrModifier& Modifier, const FAttrCategor
6262 // Remove category if empty
6363 CategoryMods.HeapRemoveAt (CatId);
6464
65- // Reduce Id, because current one doesn't exist anymore
65+ // Reduce Id, because current one doesn't exist anymore
6666 --CatId;
6767 }
6868 }
@@ -89,18 +89,17 @@ bool FBaseAttr::RemoveModifier(const FAttrModifier& Modifier, const FAttrCategor
8989 }
9090 else
9191 {
92- UE_LOG (LogAttributes, Warning, TEXT (" Attributes: Tried to remove with modifier category '%s', but it doesnt exist on the attribute" ), *Category.Name .ToString ());
92+ UE_LOG (LogAttributes, Warning,
93+ TEXT (" Attributes: Tried to remove with modifier category '%s', but it doesnt exist on the "
94+ " attribute" ),
95+ *Category.Name .ToString ());
9396 return false ;
9497 }
9598 }
9699
97100 if (bChanged)
98101 {
99- InternalRefreshValue ({
100- EAttributeOperation::RemovedMod,
101- Modifier,
102- Category
103- });
102+ InternalRefreshValue ({EAttributeOperation::RemovedMod, Modifier, Category});
104103 }
105104 return bChanged;
106105}
@@ -142,11 +141,7 @@ void FBaseAttr::CleanCategoryModifiers(const FAttrCategory& Category)
142141 BaseModifiers.Empty ();
143142
144143 // Notify
145- InternalRefreshValue ({
146- EAttributeOperation::RemovedCategory,
147- {},
148- Category
149- });
144+ InternalRefreshValue ({EAttributeOperation::RemovedCategory, {}, Category});
150145 }
151146 }
152147 else
@@ -158,15 +153,14 @@ void FBaseAttr::CleanCategoryModifiers(const FAttrCategory& Category)
158153 CategoryMods.HeapRemoveAt (Index);
159154
160155 // Notify
161- InternalRefreshValue ({
162- EAttributeOperation::RemovedCategory,
163- {},
164- Category
165- });
156+ InternalRefreshValue ({EAttributeOperation::RemovedCategory, {}, Category});
166157 }
167158 else
168159 {
169- UE_LOG (LogAttributes, Warning, TEXT (" Attributes: Tried to remove all modifiers of category '%s', but it didnt exist on the attribute" ), *Category.Name .ToString ());
160+ UE_LOG (LogAttributes, Warning,
161+ TEXT (" Attributes: Tried to remove all modifiers of category '%s', but it didnt exist on the "
162+ " attribute" ),
163+ *Category.Name .ToString ());
170164 return ;
171165 }
172166 }
@@ -180,10 +174,6 @@ void FBaseAttr::CleanModifiers()
180174 BaseModifiers.Empty ();
181175 CategoryMods.Empty ();
182176
183- InternalRefreshValue ({
184- EAttributeOperation::RemovedAllMods,
185- {},
186- FAttrCategory::NoCategory
187- });
177+ InternalRefreshValue ({EAttributeOperation::RemovedAllMods, {}, FAttrCategory::NoCategory});
188178 }
189179}
0 commit comments