fix conflict with PyTK's map display device

This commit is contained in:
Jesse Plamondon-Willard 2020-09-16 17:35:25 -04:00
parent 436eb95a86
commit f06b4dd610
No known key found for this signature in database
GPG Key ID: CF8B1456B3E29F49
2 changed files with 16 additions and 2 deletions

View File

@ -10,6 +10,7 @@
## Upcoming release
* For players:
* Fixed errors on Linux/Mac due to mods with incorrect filename case.
* Fixed map rendering crash due to conflict between SMAPI and PyTK.
* For modders:
* All content pack file paths accessed through `IContentPack` are now case-insensitive.

View File

@ -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()
{