From 19f8c52ac4f8be751d320000d67121a49e2d2715 Mon Sep 17 00:00:00 2001 From: CaptainD54321 Date: Tue, 23 Apr 2024 19:31:13 -0400 Subject: [PATCH] Fixed ANOTHER f*cking bug --- CaptainDTweaks.csproj | 2 +- Patches/DemandViewer.cs | 17 ++++++++++------- Plugin.cs | 2 +- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/CaptainDTweaks.csproj b/CaptainDTweaks.csproj index c97cdc2..76bc0a6 100644 --- a/CaptainDTweaks.csproj +++ b/CaptainDTweaks.csproj @@ -4,7 +4,7 @@ netstandard2.0 CaptainDTweaks Tweaks and fixes for the game Sailwind - 1.0.3 + 1.0.4 true latest diff --git a/Patches/DemandViewer.cs b/Patches/DemandViewer.cs index 5cb7d35..c049a32 100644 --- a/Patches/DemandViewer.cs +++ b/Patches/DemandViewer.cs @@ -215,11 +215,13 @@ public static void Load(ref TraderBoat[] ___traderBoats) { } // Plugin.logger.LogInfo("CaptainDTweaks.DemandViewer: Loading player known reports."); - /* for (int i = 0; i < GameState.playerKnownPrices.Length; i++) { - if (saveContainer.playerReports[i] == null) continue; - GameState.playerKnownPrices[i] = saveContainer.playerReports[i]; - } */ - GameState.playerKnownPrices = saveContainer.playerReports?.Clone() as PriceReport[]; + if (saveContainer.playerReports != null) { + for (int i = 0; i < GameState.playerKnownPrices.Length; i++) { + if (saveContainer.playerReports[i] == null) continue; + GameState.playerKnownPrices[i] = saveContainer.playerReports[i]; + } + } + //GameState.playerKnownPrices = (saveContainer.playerReports?.Clone()) as PriceReport[]; // Plugin.logger.LogInfo("CaptainDTweaks.DemandViewer: Loading port known reports."); foreach (Port port in Port.ports) { @@ -272,8 +274,9 @@ public static IEnumerator SaveGame(IEnumerator original) { // store the player's known prices as SupplyPriceReports and then convert them to PriceReports for RL's save code for (int i = 0; i < GameState.playerKnownPrices.Length; i++) { if(GameState.playerKnownPrices[i] == null) continue; - mySave.playerReports[i] = GameState.playerKnownPrices[i] as SupplyPriceReport; // ?? new SupplyPriceReport(GameState.playerKnownPrices[i]); - GameState.playerKnownPrices[i] = new PriceReport(GameState.playerKnownPrices[i]); + mySave.playerReports[i] = GameState.playerKnownPrices[i] as SupplyPriceReport; + var temp = new PriceReport(GameState.playerKnownPrices[i]); + GameState.playerKnownPrices[i] = temp; } } diff --git a/Plugin.cs b/Plugin.cs index 56a1597..0fd4a4f 100644 --- a/Plugin.cs +++ b/Plugin.cs @@ -14,7 +14,7 @@ public class Plugin : BaseUnityPlugin { public const string PLUGIN_GUID = "com.captaind54321.tweaks"; public const string PLUGIN_NAME = "CaptainD's Tweaks"; - public const string PLUGIN_VERSION = "0.1.0"; + public const string PLUGIN_VERSION = "1.0.4"; internal static Plugin instance;