summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/release-notes.md1
-rw-r--r--src/SMAPI/Framework/ContentManagers/ModContentManager.cs17
2 files changed, 14 insertions, 4 deletions
diff --git a/docs/release-notes.md b/docs/release-notes.md
index b6b14f97..701471ee 100644
--- a/docs/release-notes.md
+++ b/docs/release-notes.md
@@ -21,6 +21,7 @@
* For modders:
* Added asset propagation for `Data\Concessions`.
* Added SMAPI version and bitness to the console title before startup to simplify troubleshooting.
+ * If a map loads a tilesheet path with no file extension, SMAPI now automatically links it to a `.png` version in the map folder if possible.
* Improved error-handling during asset propagation.
* Fixed `Context.IsMainPlayer` returning true for a farmhand in split-screen mode before the screen is initialized.
* Fixed error when editing bundle data while a split-screen player is joining.
diff --git a/src/SMAPI/Framework/ContentManagers/ModContentManager.cs b/src/SMAPI/Framework/ContentManagers/ModContentManager.cs
index 9af14cb5..0cd431e8 100644
--- a/src/SMAPI/Framework/ContentManagers/ModContentManager.cs
+++ b/src/SMAPI/Framework/ContentManagers/ModContentManager.cs
@@ -34,6 +34,9 @@ namespace StardewModdingAPI.Framework.ContentManagers
/// <summary>The language code for language-agnostic mod assets.</summary>
private readonly LanguageCode DefaultLanguage = Constants.DefaultLanguage;
+ /// <summary>If a map tilesheet's image source has no file extensions, the file extensions to check for in the local mod folder.</summary>
+ private readonly string[] LocalTilesheetExtensions = { ".png", ".xnb" };
+
/*********
** Public methods
@@ -215,11 +218,17 @@ namespace StardewModdingAPI.Framework.ContentManagers
FileInfo file = new FileInfo(Path.Combine(this.FullRootDirectory, path));
// try with default extension
- if (!file.Exists && file.Extension.ToLower() != ".xnb")
+ if (!file.Exists && file.Extension == string.Empty)
{
- FileInfo result = new FileInfo(file.FullName + ".xnb");
- if (result.Exists)
- file = result;
+ foreach (string extension in this.LocalTilesheetExtensions)
+ {
+ FileInfo result = new FileInfo(file.FullName + extension);
+ if (result.Exists)
+ {
+ file = result;
+ break;
+ }
+ }
}
return file;