Skip to content

Commit

Permalink
also add one in save data init
Browse files Browse the repository at this point in the history
  • Loading branch information
MegaPiggy committed Sep 16, 2024
1 parent c2e62b7 commit 8db7c1f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Winch/Patches/SaveManagerPatcher.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using HarmonyLib;
using Winch.Components;
using Winch.Core;
using Winch.Util;
using static ContinueOrNewButton;
Expand Down Expand Up @@ -166,4 +167,21 @@ public static bool OnSaveSlotLoadButtonClicked(SaveSlotUI __instance)
}
return false;
}

[HarmonyPrefix]
[HarmonyPatch(typeof(SaveData), nameof(SaveData.Init))]
public static void SaveData_Init_Prefix(SaveData __instance)
{
foreach (GridKey gridKey in EnumUtil.GetValues<GridKey>())
{
if (gridKey != GridKey.NONE)
{
GridConfiguration gridConfiguration = gridKey == GridKey.INVENTORY ? GameManager.Instance.GameConfigData.GetGridConfigForHullTier(__instance.HullTier) : GameManager.Instance.GameConfigData.GetGridConfigForKey(gridKey);
if (gridConfiguration == null)
{
WinchCore.Log.Error($"Could not find gridConfiguration for gridKey: {gridKey}. Every grid key enum value is REQUIRED to be associated with a grid configuration in the GameConfigData or else the game will not initialize!");
}
}
}
}
}

0 comments on commit 8db7c1f

Please sign in to comment.