Skip to content

Commit

Permalink
Fixed filters being reseted after saving or loading
Browse files Browse the repository at this point in the history
  • Loading branch information
muit committed Nov 26, 2020
1 parent 669d990 commit 005ded8
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ void USlotDataTask_Loader::PrepareLevel(const ULevel* Level, FLevelRecord& Level
void USlotDataTask_Loader::FinishedDeserializing()
{
// Clean serialization data
SlotData->Clean(true);
SlotData->CleanRecords(true);
GetManager()->__SetCurrentData(SlotData);

Finish(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void USlotDataTask_Saver::OnStart()

SlotInfo = Manager->GetCurrentInfo();
SlotData = Manager->GetCurrentData();
SlotData->Clean(true);
SlotData->CleanRecords(true);

check(SlotInfo && SlotData);

Expand Down Expand Up @@ -133,7 +133,7 @@ void USlotDataTask_Saver::OnFinish(bool bSuccess)
if (bSuccess)
{
// Clean serialization data
SlotData->Clean(true);
SlotData->CleanRecords(true);

SELog(Preset, "Finished Saving", FColor::Green);
}
Expand Down
3 changes: 1 addition & 2 deletions Source/SaveExtension/Private/SlotData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,11 @@ void USlotData::Serialize(FArchive& Ar)
Ar << SubLevels;
}

void USlotData::Clean(bool bKeepSublevels)
void USlotData::CleanRecords(bool bKeepSublevels)
{
//Clean Up serialization data
GameInstance = {};

GeneralLevelFilter = {};
MainLevel.CleanRecords();
if (!bKeepSublevels)
{
Expand Down
2 changes: 1 addition & 1 deletion Source/SaveExtension/Public/SlotData.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class SAVEEXTENSION_API USlotData : public USaveGame
TArray<FStreamingLevelRecord> SubLevels;


void Clean(bool bKeepSublevels);
void CleanRecords(bool bKeepSublevels);

/** Using manual serialization. It's way faster than reflection serialization */
virtual void Serialize(FArchive& Ar) override;
Expand Down

0 comments on commit 005ded8

Please sign in to comment.