Skip to content

Commit

Permalink
Fixed ANOTHER f*cking bug
Browse files Browse the repository at this point in the history
  • Loading branch information
CaptainD54321 committed Apr 23, 2024
1 parent 6b304c4 commit 19f8c52
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CaptainDTweaks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>CaptainDTweaks</AssemblyName>
<Description>Tweaks and fixes for the game Sailwind</Description>
<Version>1.0.3</Version>
<Version>1.0.4</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion>
</PropertyGroup>
Expand Down
17 changes: 10 additions & 7 deletions Patches/DemandViewer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}
}

Expand Down
2 changes: 1 addition & 1 deletion Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 19f8c52

Please sign in to comment.