Ven0maus / SOD.Common

A common library for shadows of doubt modding.
MIT License
4 stars 4 forks source link

[BUG] If RunSimulation is set to true and i try to load into a save, Stock Market causes game to freeze on load #23

Closed baseballjustin5 closed 6 months ago

baseballjustin5 commented 6 months ago

Describe the bug If I set "RunSimulation" to true, then load into a save, where StockMarket has been run before, the game hangs on loading 20240316061108_1

Reproduction scenario Set RunSimulation value inside "BepInEx/config/Venomaus.SOD.StockMarket.cfg" to true then load into a previous save that has been loaded with the mod before, instead of starting a new game/or using a previously unmodded save.

Also included is my modlist in case it's a different mod doing it:

BepInExPack_IL2CPP v6.0.667 by BepInEx
CityDirectoryPhoneNumbers v1.0.5 by Piepieonline
SODCommon v1.1.7 by Venomaus
SODQoL v1.1.1 by Venomaus
PrintBugfix v0.1.1 by TeamSpyraxi
DDSLoader v1.0.4 by Piepieonline
Asset_Bundle_Loader v1.0.4 by Piepieonline
SODStockMarket v2.0.2 by Venomaus
HoursOfOperation v0.1.0 by TeamSpyraxi
BepInExConfigManager v1.3.1 by TeamSpyraxi

Expected behavior Load continues as normal if previous save file is loaded

Additional context This is in the CmD window that launches alongside the game when launching as "modded" from Thunderstore:

[Info   :StockMarket] - End of Stocks -
[Info   :StockMarket] Stock market loaded.
[Error  :Il2CppInterop] During invoking native->managed trampoline
Exception: System.Exception: Time is not initialized at this state of the game, check for the property "Lib.Time.IsInitialized".
   at SOD.Common.Helpers.Time.get_CurrentDateTime()
   at SOD.StockMarket.Implementation.Trade.TradeController.Market_OnCalculate(Object sender, EventArgs e)
   at SOD.StockMarket.Implementation.Market.Calculate()
   at SOD.StockMarket.Implementation.Market.Simulate(Int32 days)
   at SOD.StockMarket.Implementation.Market.<.ctor>b__26_0(Object sender, EventArgs args)
   at SOD.StockMarket.Implementation.Market.PostStocksInitialization(Type type)
   at SOD.StockMarket.Implementation.Stocks.StockDataIO.Import(Market market, TradeController tradeController, String path)
   at SOD.StockMarket.Implementation.Market.OnFileLoad(Object sender, SaveGameArgs e)
   at SOD.Common.Helpers.SaveGame.OnLoad(String path, Boolean after)
   at SOD.Common.Patches.SaveStateControllerPatches.CityConstructor_StartLoading.Prefix(CityConstructor __instance)
   at DMD<CityConstructor::StartLoading>(CityConstructor this)
   at (il2cpp -> managed) StartLoading(IntPtr , Il2CppMethodInfo* )
Ven0maus commented 6 months ago

RunSimulation is mainly used for debugging reasons while developing the mod, it could be that at the time I hadn't have it support save loading, but I will take a look at it :)

baseballjustin5 commented 6 months ago

Ah ok, figured I'd at least let you know!

On Sat, Mar 16, 2024, 06:48 Venomaus @.***> wrote:

RunSimulation is mainly used for debugging reasons while developing the mod, it could be that at the time I hadn't have it support save loading, but I will take a look at it :)

— Reply to this email directly, view it on GitHub https://github.com/Ven0maus/SOD.Common/issues/23#issuecomment-2001961492, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCDCNIWORI34SG6X5A7GPLYYQWRVAVCNFSM6AAAAABEZH2DSOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBRHE3DCNBZGI . You are receiving this because you authored the thread.Message ID: @.***>

Ven0maus commented 6 months ago

Fixed in upcoming v2.0.3