Skip to content

Commit

Permalink
Skip loading saves prior to the supported version in the editor.
Browse files Browse the repository at this point in the history
  • Loading branch information
isadorasophia committed Sep 23, 2024
1 parent dd0b5c0 commit 4df628d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Murder.Editor/Data/EditorDataManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,12 @@ private async Task LoadAllSaveAssets()
continue;
}

if (save.Version < Game.Data.CurrentGameVersion)
{
GameLogger.Warning($"Skipping loading save {save.Name} due to older version ({save.Version}).");
continue;
}

PackedSaveData? packedData = FileManager.UnpackContent<PackedSaveData>(saveDataPath);
PackedSaveAssetsData? packedAssetsData = FileManager.UnpackContent<PackedSaveAssetsData>(saveDataAssetsPath);
if (packedData is null || packedAssetsData is null)
Expand Down
2 changes: 2 additions & 0 deletions src/Murder/Data/GameDataManager_Save.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ protected virtual SaveData CreateSaveDataWithVersion(int slot)
/// </summary>
public virtual string GameDirectory => _game?.Name ?? "Murder";

public virtual float CurrentGameVersion => _game?.Version ?? 1;

private string? _saveBasePath = null;

/// <summary>
Expand Down

0 comments on commit 4df628d

Please sign in to comment.