summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/SGame.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2018-11-25 13:14:45 -0500
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2018-11-25 13:14:45 -0500
commitb34cbb5b860ac4cd4a4b9e564e6e53245be3e790 (patch)
treebdd83e5fa5c260a84111ef39056b4f150a0612aa /src/SMAPI/Framework/SGame.cs
parentcbd63b9a879031f20b8d04db83505dbcbe21bd47 (diff)
downloadSMAPI-b34cbb5b860ac4cd4a4b9e564e6e53245be3e790.tar.gz
SMAPI-b34cbb5b860ac4cd4a4b9e564e6e53245be3e790.tar.bz2
SMAPI-b34cbb5b860ac4cd4a4b9e564e6e53245be3e790.zip
fix error when leaving & rejoining a server in the same session
Diffstat (limited to 'src/SMAPI/Framework/SGame.cs')
-rw-r--r--src/SMAPI/Framework/SGame.cs15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/SMAPI/Framework/SGame.cs b/src/SMAPI/Framework/SGame.cs
index 75cf4c52..9c6ff4dd 100644
--- a/src/SMAPI/Framework/SGame.cs
+++ b/src/SMAPI/Framework/SGame.cs
@@ -206,6 +206,15 @@ namespace StardewModdingAPI.Framework
this.Events.ModMessageReceived.RaiseForMods(new ModMessageReceivedEventArgs(message), mod => mod != null && modIDs.Contains(mod.Manifest.UniqueID));
}
+ /// <summary>A callback raised when the player quits a save and returns to the title screen.</summary>
+ private void OnReturnedToTitle()
+ {
+ this.Monitor.Log("Context: returned to title", LogLevel.Trace);
+ this.Multiplayer.Peers.Clear();
+ this.Events.ReturnedToTitle.RaiseEmpty();
+ this.Events.Legacy_AfterReturnToTitle.Raise();
+ }
+
/// <summary>Constructor a content manager to read XNB files.</summary>
/// <param name="serviceProvider">The service provider to use to locate services.</param>
/// <param name="rootDirectory">The root directory to search for content.</param>
@@ -430,11 +439,7 @@ namespace StardewModdingAPI.Framework
** Load / return-to-title events
*********/
if (wasWorldReady && !Context.IsWorldReady)
- {
- this.Monitor.Log("Context: returned to title", LogLevel.Trace);
- this.Events.ReturnedToTitle.RaiseEmpty();
- this.Events.Legacy_AfterReturnToTitle.Raise();
- }
+ this.OnReturnedToTitle();
else if (!this.RaisedAfterLoadEvent && Context.IsWorldReady)
{
// print context