Skip to content

Commit 3e7bbe4

Browse files
Fix SML C++ build errors when building for Linux targets
1 parent a5dab6e commit 3e7bbe4

6 files changed

Lines changed: 19 additions & 19 deletions

File tree

Mods/SML/Source/SML/Private/Configuration/ConfigManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ void UConfigManager::ReinitializeCachedStructs(const FConfigId& ConfigId) {
155155
const FRegisteredConfigurationData& ConfigurationData = Configurations.FindChecked(ConfigId);
156156
URootConfigValueHolder* RootConfigValue = ConfigurationData.RootValue;
157157

158-
for (const TPair<UScriptStruct*, FReflectedObject>& Pair : ConfigurationData.CachedValues) {
158+
for (const TPair<TObjectPtr<UScriptStruct>, FReflectedObject>& Pair : ConfigurationData.CachedValues) {
159159
RootConfigValue->GetWrappedValue()->FillConfigStructSelf(Pair.Value);
160160
}
161161
#endif

Mods/SML/Source/SML/Private/Configuration/Properties/ConfigPropertySection.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
#define LOCTEXT_NAMESPACE "SML"
99

1010
FString UConfigPropertySection::DescribeValue_Implementation() const {
11-
const FString ElementsString = FString::JoinBy(SectionProperties, TEXT(", "), [this](const TPair<FString, UConfigProperty*>& Property) {
11+
const FString ElementsString = FString::JoinBy(SectionProperties, TEXT(", "), [this](const TPair<FString, TObjectPtr<UConfigProperty>>& Property) {
1212
return FString::Printf(TEXT("%s = %s"), *Property.Key, *Property.Value->DescribeValue());
1313
});
1414
return FString::Printf(TEXT("[section %s]"), *ElementsString);
1515
}
1616

1717
URawFormatValue* UConfigPropertySection::Serialize_Implementation(UObject* Outer) const {
1818
URawFormatValueObject* ObjectValue = NewObject<URawFormatValueObject>(Outer);
19-
for (const TPair<FString, UConfigProperty*>& Property : SectionProperties) {
19+
for (const TPair<FString, TObjectPtr<UConfigProperty>>& Property : SectionProperties) {
2020
if (Property.Value != NULL) {
2121
URawFormatValue* RawChildValue = Property.Value->Serialize(ObjectValue);
2222
if (RawChildValue != NULL) {
@@ -30,7 +30,7 @@ URawFormatValue* UConfigPropertySection::Serialize_Implementation(UObject* Outer
3030
void UConfigPropertySection::Deserialize_Implementation(const URawFormatValue* Value) {
3131
const URawFormatValueObject* ObjectValue = Cast<URawFormatValueObject>(Value);
3232
if (ObjectValue != NULL) {
33-
for (const TPair<FString, UConfigProperty*>& Property : SectionProperties) {
33+
for (const TPair<FString, TObjectPtr<UConfigProperty>>& Property : SectionProperties) {
3434
const URawFormatValue* RawChildValue = ObjectValue->GetValue(Property.Key);
3535
if (Property.Value != NULL && RawChildValue != NULL) {
3636
if (!bAllowUserReset || !bParentSectionAllowsUserReset) {
@@ -43,7 +43,7 @@ void UConfigPropertySection::Deserialize_Implementation(const URawFormatValue* V
4343
}
4444

4545
void UConfigPropertySection::FillConfigStructSelf(const FReflectedObject& ReflectedObject) const {
46-
for (const TPair<FString, UConfigProperty*>& Property : SectionProperties) {
46+
for (const TPair<FString, TObjectPtr<UConfigProperty>>& Property : SectionProperties) {
4747
if (Property.Value != NULL) {
4848
Property.Value->FillConfigStruct(ReflectedObject, Property.Key);
4949
}
@@ -66,7 +66,7 @@ bool IsValidConfigIdentifier(const FString& Identifier) {
6666
#if WITH_EDITOR
6767
EDataValidationResult UConfigPropertySection::IsDataValid(TArray<FText>& ValidationErrors) {
6868
EDataValidationResult ValidationResult = EDataValidationResult::Valid;
69-
for (const TPair<FString, UConfigProperty*>& Pair : SectionProperties) {
69+
for (const TPair<FString, TObjectPtr<UConfigProperty>>& Pair : SectionProperties) {
7070
if (!IsValid(Pair.Value)) {
7171
ValidationErrors.Add(FText::Format(LOCTEXT("ConfigSectionValueNull",
7272
"Value '{0}' inside of the Config Section '{1}' is NULL."),
@@ -102,7 +102,7 @@ bool UConfigPropertySection::ResetToDefault_Implementation() {
102102
return false;
103103
}
104104
bool bAnyReset = (SectionProperties.Num() == 0);
105-
for (const TPair<FString, UConfigProperty*>& Pair : SectionProperties) {
105+
for (const TPair<FString, TObjectPtr<UConfigProperty>>& Pair : SectionProperties) {
106106
UConfigProperty* Property = Pair.Value;
107107
if (Property) {
108108
bool bResetThisOne = Property->ResetToDefault();
@@ -116,7 +116,7 @@ bool UConfigPropertySection::ResetToDefault_Implementation() {
116116
}
117117

118118
bool UConfigPropertySection::IsSetToDefaultValue_Implementation() const {
119-
for (const TPair<FString, UConfigProperty*>& Pair : SectionProperties) {
119+
for (const TPair<FString, TObjectPtr<UConfigProperty>>& Pair : SectionProperties) {
120120
UConfigProperty* Property = Pair.Value;
121121
if (IsValid(Property) && !Property->IsSetToDefaultValue()) {
122122
return false;
@@ -126,7 +126,7 @@ bool UConfigPropertySection::IsSetToDefaultValue_Implementation() const {
126126
}
127127

128128
bool UConfigPropertySection::HasResettableChildProperty(bool bIncludeHidden = true) const {
129-
for (const TPair<FString, UConfigProperty*>& Pair : SectionProperties) {
129+
for (const TPair<FString, TObjectPtr<UConfigProperty>>& Pair : SectionProperties) {
130130
UConfigProperty* Property = Pair.Value;
131131
if (!IsValid(Property)) {
132132
continue;
@@ -152,7 +152,7 @@ void UConfigPropertySection::HandleMarkDirty_Implementation() {
152152
FConfigVariableDescriptor UConfigPropertySection::CreatePropertyDescriptor_Implementation(
153153
UConfigGenerationContext* Context, const FString& OuterPath) const {
154154
UConfigGeneratedStruct* GeneratedStruct = Context->CreateNewConfigStruct(OuterPath);
155-
for (const TPair<FString, UConfigProperty*>& Property : SectionProperties) {
155+
for (const TPair<FString, TObjectPtr<UConfigProperty>>& Property : SectionProperties) {
156156
const FString InnerPath = FString::Printf(TEXT("%s_%s"), *OuterPath, *Property.Key);
157157
const FConfigVariableDescriptor Descriptor = Property.Value->CreatePropertyDescriptor(Context, InnerPath);
158158
GeneratedStruct->AddConfigVariable(Descriptor, Property.Key);

Mods/SML/Source/SML/Private/Module/ModModule.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ void UModModule::DispatchLifecycleEvent(ELifecyclePhase Phase) {
9090
EventsReceived.Add(Phase);
9191

9292
//Process phase event on already spawned child modules
93-
for (const TPair<FName, UModModule*>& ModModule : ChildModules) {
93+
for (const TPair<FName, TObjectPtr<UModModule>>& ModModule : ChildModules) {
9494
ModModule.Value->DispatchLifecycleEvent(Phase);
9595
}
9696

Mods/SML/Source/SML/Private/Reflection/BlueprintReflectedObject.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -360,10 +360,10 @@ IMPLEMENT_PROPERTY_TYPE(BoolProperty, false);
360360
IMPLEMENT_PROPERTY_TYPE(NameProperty, NAME_None);
361361
IMPLEMENT_PROPERTY_TYPE(TextProperty, FText::GetEmpty());
362362
IMPLEMENT_PROPERTY_TYPE(StrProperty, TEXT(""));
363-
IMPLEMENT_PROPERTY_TYPE(ObjectProperty, NULL);
364-
IMPLEMENT_PROPERTY_TYPE(WeakObjectProperty, NULL);
365-
IMPLEMENT_PROPERTY_TYPE(LazyObjectProperty, FLazyObjectPtr(NULL));
366-
IMPLEMENT_PROPERTY_TYPE(SoftObjectProperty, FSoftObjectPtr(NULL));
363+
IMPLEMENT_PROPERTY_TYPE(ObjectProperty, nullptr);
364+
IMPLEMENT_PROPERTY_TYPE(WeakObjectProperty, nullptr);
365+
IMPLEMENT_PROPERTY_TYPE(LazyObjectProperty, FLazyObjectPtr());
366+
IMPLEMENT_PROPERTY_TYPE(SoftObjectProperty, FSoftObjectPtr());
367367

368368
FReflectedObject FReflectedObject::GetStructProperty(FName PropertyName) const {
369369
FReflectedObject ReflectedObject{};

Mods/SML/Source/SML/Private/SessionSettings/SessionSettingsManager.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ void USessionSettingsManager::OnOptionUpdated(FString String, FVariant Value) co
117117
FString USessionSettingsManager::SerializeSettingsToString() const {
118118
TArray<FString> OptionStrings;
119119

120-
for (const TPair<FString, UFGUserSettingApplyType*>& Pair : SessionSettings) {
120+
for (const TPair<FString, TObjectPtr<UFGUserSettingApplyType>>& Pair : SessionSettings) {
121121
FString Name = Pair.Key;
122122
FVariant Value = Pair.Value->GetPendingAppliedValue();
123123
if (Value.IsEmpty())
@@ -193,13 +193,13 @@ bool USessionSettingsManager::IsGlobalManager() const {
193193
}
194194

195195
void USessionSettingsManager::SubscribeToAllOptionUpdates(const FOnOptionUpdated& onOptionUpdatedDelegate) {
196-
for (const TTuple<FString, UFGUserSettingApplyType*>& Options : SessionSettings) {
196+
for (const TTuple<FString, TObjectPtr<UFGUserSettingApplyType>>& Options : SessionSettings) {
197197
Options.Value->AddSubscriber(onOptionUpdatedDelegate);
198198
}
199199
}
200200

201201
void USessionSettingsManager::UnsubscribeToAllOptionUpdates(const FOnOptionUpdated& onOptionUpdatedDelegate) {
202-
for (const TTuple<FString, UFGUserSettingApplyType*>& Options : SessionSettings) {
202+
for (const TTuple<FString, TObjectPtr<UFGUserSettingApplyType>>& Options : SessionSettings) {
203203
Options.Value->RemoveSubscriber(onOptionUpdatedDelegate);
204204
}
205205
}

Mods/SML/Source/SML/Public/Reflection/BlueprintReflectedObject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ class SML_API FReflectedObjectState_UObject : public FReflectedObjectState {
226226
virtual void* GetObjectData() override;
227227
virtual void AddReferencedObjects(FReferenceCollector& ReferenceCollector) override;
228228
private:
229-
UObject* ReferencedObject;
229+
TObjectPtr<UObject> ReferencedObject;
230230
};
231231

232232
class SML_API FReflectedObjectState_ScriptStruct : public FReflectedObjectState {

0 commit comments

Comments
 (0)