From ea74b93f38eddfe87603e92bf838a11598588998 Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Wed, 18 Aug 2021 11:00:26 -0400 Subject: [PATCH] Fix loading levels that are... uh, just levels. --- desktop_version/src/FileSystemUtils.cpp | 2 +- desktop_version/src/FileSystemUtils.h | 1 + desktop_version/src/editor.cpp | 6 +++++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/desktop_version/src/FileSystemUtils.cpp b/desktop_version/src/FileSystemUtils.cpp index b114cb86..a06d868a 100644 --- a/desktop_version/src/FileSystemUtils.cpp +++ b/desktop_version/src/FileSystemUtils.cpp @@ -241,7 +241,7 @@ bool FILESYSTEM_isMounted(const char* filename) return PHYSFS_getMountPoint(filename) != NULL; } -static bool FILESYSTEM_exists(const char *fname) +bool FILESYSTEM_exists(const char *fname) { return PHYSFS_exists(fname); } diff --git a/desktop_version/src/FileSystemUtils.h b/desktop_version/src/FileSystemUtils.h index c0269ce1..81d2d300 100644 --- a/desktop_version/src/FileSystemUtils.h +++ b/desktop_version/src/FileSystemUtils.h @@ -17,6 +17,7 @@ char *FILESYSTEM_getUserLevelDirectory(void); bool FILESYSTEM_isFile(const char* filename); bool FILESYSTEM_isMounted(const char* filename); +bool FILESYSTEM_exists(const char *filename); void FILESYSTEM_loadZip(const char* filename); bool FILESYSTEM_mountAssets(const char *path); diff --git a/desktop_version/src/editor.cpp b/desktop_version/src/editor.cpp index fbcf20c7..3f9a252a 100644 --- a/desktop_version/src/editor.cpp +++ b/desktop_version/src/editor.cpp @@ -1770,7 +1770,11 @@ bool editorclass::load(std::string& _path) } else { - MAYBE_FAIL(FILESYSTEM_mountAssets(_path.c_str())); + /* "Sometimes a level is just a level." */ + if (!FILESYSTEM_exists(_path.c_str())) + { + MAYBE_FAIL(FILESYSTEM_mountAssets(_path.c_str())); + } } if (!FILESYSTEM_loadTiXml2Document(_path.c_str(), doc))