diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2020-09-16 17:35:25 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2020-09-16 17:35:25 -0400 |
commit | f06b4dd6102e64f929a218192002c1d2ba05ebed (patch) | |
tree | 51bdf3f0fd285e21598a652d65d747c71017d375 /src/SMAPI/Framework | |
parent | 436eb95a8617cf6df061a61b66d6cd7c1cd6a494 (diff) | |
download | SMAPI-f06b4dd6102e64f929a218192002c1d2ba05ebed.tar.gz SMAPI-f06b4dd6102e64f929a218192002c1d2ba05ebed.tar.bz2 SMAPI-f06b4dd6102e64f929a218192002c1d2ba05ebed.zip |
fix conflict with PyTK's map display device
Diffstat (limited to 'src/SMAPI/Framework')
-rw-r--r-- | src/SMAPI/Framework/SCore.cs | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/SMAPI/Framework/SCore.cs b/src/SMAPI/Framework/SCore.cs index c9477c52..e64c2801 100644 --- a/src/SMAPI/Framework/SCore.cs +++ b/src/SMAPI/Framework/SCore.cs @@ -43,6 +43,7 @@ using StardewModdingAPI.Toolkit.Serialization; using StardewModdingAPI.Toolkit.Utilities; using StardewModdingAPI.Utilities; using StardewValley; +using xTile.Display; using SObject = StardewValley.Object; namespace StardewModdingAPI.Framework @@ -472,8 +473,13 @@ namespace StardewModdingAPI.Framework SCore.PerformanceMonitor.PrintQueuedAlerts(); // reapply overrides - if (this.JustReturnedToTitle && !(Game1.mapDisplayDevice is SDisplayDevice)) - Game1.mapDisplayDevice = new SDisplayDevice(Game1.content, Game1.game1.GraphicsDevice); + if (this.JustReturnedToTitle) + { + if (!(Game1.mapDisplayDevice is SDisplayDevice)) + Game1.mapDisplayDevice = this.GetMapDisplayDevice(); + + this.JustReturnedToTitle = false; + } /********* ** First-tick initialization @@ -1738,6 +1744,13 @@ namespace StardewModdingAPI.Framework return translations; } + /// <summary>Get the map display device which applies SMAPI features like tile rotation to loaded maps.</summary> + /// <remarks>This is separate to let mods like PyTK wrap it with their own functionality.</remarks> + private IDisplayDevice GetMapDisplayDevice() + { + return new SDisplayDevice(Game1.content, Game1.game1.GraphicsDevice); + } + /// <summary>Get the absolute path to the next available log file.</summary> private string GetLogPath() { |