summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2018-04-22 21:15:19 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2018-04-22 21:15:19 -0400
commit2b2ad7a48621e7f70e92cba72b14e56ebe9becb9 (patch)
tree0054adf9ebef96d676354f1530e03c80c974675a /src
parentb2c4218e0dec8c62906ccf8a762f0bf84e14a74f (diff)
downloadSMAPI-2b2ad7a48621e7f70e92cba72b14e56ebe9becb9.tar.gz
SMAPI-2b2ad7a48621e7f70e92cba72b14e56ebe9becb9.tar.bz2
SMAPI-2b2ad7a48621e7f70e92cba72b14e56ebe9becb9.zip
fix save/load event precedence (#453)
Diffstat (limited to 'src')
-rw-r--r--src/SMAPI/Framework/SGame.cs73
1 files changed, 37 insertions, 36 deletions
diff --git a/src/SMAPI/Framework/SGame.cs b/src/SMAPI/Framework/SGame.cs
index 3b9a159f..4f5bd96b 100644
--- a/src/SMAPI/Framework/SGame.cs
+++ b/src/SMAPI/Framework/SGame.cs
@@ -237,42 +237,6 @@ namespace StardewModdingAPI.Framework
}
/*********
- ** Update context
- *********/
- if (Context.IsSaveLoaded && !SaveGame.IsProcessing /*still loading save*/ && this.AfterLoadTimer >= 0)
- {
- if (Game1.dayOfMonth != 0) // wait until new-game intro finishes (world not fully initialised yet)
- this.AfterLoadTimer--;
- Context.IsWorldReady = this.AfterLoadTimer <= 0;
- }
-
- /*********
- ** Update watchers
- *********/
- // reset player
- if (Context.IsWorldReady)
- {
- if (this.CurrentPlayerTracker == null || this.CurrentPlayerTracker.Player != Game1.player)
- {
- this.CurrentPlayerTracker?.Dispose();
- this.CurrentPlayerTracker = new PlayerTracker(Game1.player);
- }
- }
- else
- {
- if (this.CurrentPlayerTracker != null)
- {
- this.CurrentPlayerTracker.Dispose();
- this.CurrentPlayerTracker = null;
- }
- }
-
- // update values
- foreach (IWatcher watcher in this.Watchers)
- watcher.Update();
- this.CurrentPlayerTracker?.Update();
-
- /*********
** Save events + suppress events during save
*********/
// While the game is writing to the save file in the background, mods can unexpectedly
@@ -325,6 +289,43 @@ namespace StardewModdingAPI.Framework
if (this.FirstUpdate)
this.OnGameInitialised();
+
+ /*********
+ ** Update context
+ *********/
+ if (Context.IsSaveLoaded && !SaveGame.IsProcessing /*still loading save*/ && this.AfterLoadTimer >= 0)
+ {
+ if (Game1.dayOfMonth != 0) // wait until new-game intro finishes (world not fully initialised yet)
+ this.AfterLoadTimer--;
+ Context.IsWorldReady = this.AfterLoadTimer <= 0;
+ }
+
+ /*********
+ ** Update watchers
+ *********/
+ // reset player
+ if (Context.IsWorldReady)
+ {
+ if (this.CurrentPlayerTracker == null || this.CurrentPlayerTracker.Player != Game1.player)
+ {
+ this.CurrentPlayerTracker?.Dispose();
+ this.CurrentPlayerTracker = new PlayerTracker(Game1.player);
+ }
+ }
+ else
+ {
+ if (this.CurrentPlayerTracker != null)
+ {
+ this.CurrentPlayerTracker.Dispose();
+ this.CurrentPlayerTracker = null;
+ }
+ }
+
+ // update values
+ foreach (IWatcher watcher in this.Watchers)
+ watcher.Update();
+ this.CurrentPlayerTracker?.Update();
+
/*********
** Locale changed events
*********/