diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2016-11-19 16:03:45 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2016-11-19 16:03:45 -0500 |
commit | cb6f6fe19d51acd995e33bc04c3bf243c05e34da (patch) | |
tree | 3454b25d66ce0ba102184a0b9712af729471fbf2 | |
parent | bff59aacba9f97fe90b89d2640b56be57e3866e5 (diff) | |
download | SMAPI-cb6f6fe19d51acd995e33bc04c3bf243c05e34da.tar.gz SMAPI-cb6f6fe19d51acd995e33bc04c3bf243c05e34da.tar.bz2 SMAPI-cb6f6fe19d51acd995e33bc04c3bf243c05e34da.zip |
fix race condition where GameLoaded event was sometime fired before the game was ready
-rw-r--r-- | release-notes.md | 1 | ||||
-rw-r--r-- | src/StardewModdingAPI/Inheritance/SGame.cs | 4 | ||||
-rw-r--r-- | src/StardewModdingAPI/Program.cs | 3 |
3 files changed, 5 insertions, 3 deletions
diff --git a/release-notes.md b/release-notes.md index 65fe297e..2fa17b7f 100644 --- a/release-notes.md +++ b/release-notes.md @@ -8,6 +8,7 @@ For players: * Fixed an error in 1.0 when mod uses `config.json` but the file doesn't exist. * Fixed critical errors being saved to a separate log file. * Fixed compatibility with mods that use obsolete `Log` methods.<sup>1.1.1</sup> + * Fixed race condition where some mods would sometimes crash because the game wasn't ready yet.<sup>1.1.1</sup> For developers: * Added new logging interface: diff --git a/src/StardewModdingAPI/Inheritance/SGame.cs b/src/StardewModdingAPI/Inheritance/SGame.cs index 3471d01b..ed5df125 100644 --- a/src/StardewModdingAPI/Inheritance/SGame.cs +++ b/src/StardewModdingAPI/Inheritance/SGame.cs @@ -316,6 +316,10 @@ namespace StardewModdingAPI.Inheritance // add FPS to debug output SGame.QueueDebugMessage($"FPS: {SGame.FramesPerSecond}"); + // raise game loaded + if (this.FirstUpdate) + GameEvents.InvokeGameLoaded(); + // update SMAPI events this.UpdateEventCalls(); diff --git a/src/StardewModdingAPI/Program.cs b/src/StardewModdingAPI/Program.cs index 4268a944..f3751462 100644 --- a/src/StardewModdingAPI/Program.cs +++ b/src/StardewModdingAPI/Program.cs @@ -230,9 +230,6 @@ namespace StardewModdingAPI // register help command Command.RegisterCommand("help", "Lists all commands | 'help <cmd>' returns command description").CommandFired += Program.help_CommandFired; - // raise game loaded event - GameEvents.InvokeGameLoaded(); - // listen for command line input Program.Monitor.Log("Starting console..."); Program.Monitor.Log("Type 'help' for help, or 'help <cmd>' for a command's usage", LogLevel.Info); |