summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI/Inheritance/SGame.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2016-12-27 13:52:32 -0500
committerJesse Plamondon-Willard <github@jplamondonw.com>2016-12-27 13:52:32 -0500
commitb9dd6eb742e4f0c42ed887abd0f17f113f250056 (patch)
tree352a208a25780285419b0bae73148a00a98356ff /src/StardewModdingAPI/Inheritance/SGame.cs
parentc24294c3dd73db3754d10ff8fe5bd51338555638 (diff)
parentb75d86e7cc19f9bc961abb475f22e8f2b059533c (diff)
downloadSMAPI-b9dd6eb742e4f0c42ed887abd0f17f113f250056.tar.gz
SMAPI-b9dd6eb742e4f0c42ed887abd0f17f113f250056.tar.bz2
SMAPI-b9dd6eb742e4f0c42ed887abd0f17f113f250056.zip
Merge branch 'develop' into stable
Diffstat (limited to 'src/StardewModdingAPI/Inheritance/SGame.cs')
-rw-r--r--src/StardewModdingAPI/Inheritance/SGame.cs12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/StardewModdingAPI/Inheritance/SGame.cs b/src/StardewModdingAPI/Inheritance/SGame.cs
index f70d0696..16803a73 100644
--- a/src/StardewModdingAPI/Inheritance/SGame.cs
+++ b/src/StardewModdingAPI/Inheritance/SGame.cs
@@ -913,11 +913,17 @@ namespace StardewModdingAPI.Inheritance
// raise menu changed
if (Game1.activeClickableMenu != this.PreviousActiveMenu)
{
+ // raise events
+ IClickableMenu previousMenu = this.PreviousActiveMenu;
+ IClickableMenu newMenu = Game1.activeClickableMenu;
if (Game1.activeClickableMenu != null)
- MenuEvents.InvokeMenuChanged(this.Monitor, this.PreviousActiveMenu, Game1.activeClickableMenu);
+ MenuEvents.InvokeMenuChanged(this.Monitor, previousMenu, newMenu);
else
- MenuEvents.InvokeMenuClosed(this.Monitor, this.PreviousActiveMenu);
- this.PreviousActiveMenu = Game1.activeClickableMenu;
+ MenuEvents.InvokeMenuClosed(this.Monitor, previousMenu);
+
+ // update previous menu
+ // (if the menu was changed in one of the handlers, deliberately defer detection until the next update so mods can be notified of the new menu change)
+ this.PreviousActiveMenu = newMenu;
}
// raise location list changed