Skip to content

Commit

Permalink
1.5.1 ready
Browse files Browse the repository at this point in the history
  • Loading branch information
Cattlesquat committed Dec 23, 2020
1 parent 99cd1a3 commit bc7ba34
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 16 additions & 1 deletion DeathRun/DeathRunUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,21 @@ public static void HideHighScores(bool should)

public static void RegisterSave(string slotName, DeathRunSaveData saveData)
{
saveList.Add(slotName, saveData);
DeathRunSaveData already = new DeathRunSaveData();
if (saveList.TryGetValue(slotName, out already))
{
saveList.Remove(slotName);
}

try
{
saveList.Add(slotName, saveData);
}
catch (Exception ex)
{
CattleLogger.Message("Failed to add to dictionary");
CattleLogger.GenericError(ex);
}
}

public static DeathRunSaveData FindSave(string slotName)
Expand Down Expand Up @@ -754,6 +768,7 @@ public static bool LoadFromBytes(byte[] bytes, out DeathRunSaveData target)
CattleLogger.GenericError(e);
CattleLogger.Message("Death Run thumbnail data not found - using defaults");
CattleLogger.Message(e.StackTrace);

target = null;
return false;
}
Expand Down
2 changes: 2 additions & 0 deletions DeathRun/Patchers/MainMenuPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ internal class LoadSlots_Patch
[HarmonyPrefix]
private static bool Prefix(ref List<string> fileNames)
{
CattleLogger.Message("LoadSlotsAsync");

fileNames.Add(DeathRun.SaveFile);
return true;
}
Expand Down

0 comments on commit bc7ba34

Please sign in to comment.