Use setLevelDirError for level not found & parse errors

This exports the previously-internal setLevelDirError function in
FileSystemUtils and uses it for if a level is not found or there was a
parsing error. Previously, if a level failed to load in these ways, it
would take you to the error screen with no error, while printing it to
the console. But this makes it more user-friendly.

As a bonus, the text is localizable, just like the existing usage of
FILESYSTEM_setLevelDirError for if a path couldn't be mounted.
This commit is contained in:
Misa
2023-05-17 10:09:59 -07:00
parent a5eb361448
commit 9387186083
15 changed files with 38 additions and 4 deletions

View File

@@ -456,7 +456,7 @@ const char* FILESYSTEM_getLevelDirError(void)
return levelDirError;
}
static void setLevelDirError(const char* text, const char* args_index, ...)
void FILESYSTEM_setLevelDirError(const char* text, const char* args_index, ...)
{
levelDirHasError = true;
@@ -475,7 +475,7 @@ static bool FILESYSTEM_mountAssetsFrom(const char *fname)
if (real_dir == NULL)
{
setLevelDirError(
FILESYSTEM_setLevelDirError(
loc::gettext("Could not mount {path}: real directory doesn't exist"),
"path:str",
fname