Fail building custom level if long_name is too long (#3966)

If long_name is too long, it will result in the level being invisible
but the collide loading, lets detect this and point the user in correct
direction to solve it with a clear error message.

---------

Co-authored-by: Hat Kid <6624576+Hat-Kid@users.noreply.github.com>
This commit is contained in:
ZedB0T
2025-06-22 20:07:43 -04:00
committed by GitHub
parent d352856927
commit 8fbd85b0fc
6 changed files with 12 additions and 0 deletions
@@ -1,6 +1,7 @@
{
// The "in-game" name of the level. Should be lower case, with dashes (GOAL symbol name)
// the name of this file, and the folder this file is in must have the same name.
// The long_name must also be 10 characters or fewer.
"long_name": "test-zone",
// The file name, should be upper case and 8 characters or less.
"iso_name": "TESTZONE",
@@ -1,6 +1,7 @@
{
// The "in-game" name of the level. Should be lower case, with dashes (GOAL symbol name)
// the name of this file, and the folder this file is in must have the same name.
// The long_name must also be 10 characters or fewer.
"long_name": "test-zone",
// The file name, should be upper case and 8 characters or less.
"iso_name": "TESTZONE",
@@ -1,6 +1,7 @@
{
// The "in-game" name of the level. Should be lower case, with dashes (GOAL symbol name)
// the name of this file, and the folder this file is in must have the same name.
// The long_name must also be 10 characters or fewer.
"long_name": "test-zone",
// The file name, should be upper case and 8 characters or less.
"iso_name": "TESTZONE",
+3
View File
@@ -48,6 +48,9 @@ bool run_build_level(const std::string& input_file,
// unk zero
// name
file.name = level_json.at("long_name").get<std::string>();
ASSERT_MSG(file.name.size() <= 10,
fmt::format("long_name over 10 characters ({} characters): '{}'", file.name.size(),
file.name));
// nick
file.nickname = level_json.at("nickname").get<std::string>();
// vis infos
+3
View File
@@ -42,6 +42,9 @@ bool run_build_level(const std::string& input_file,
// unk zero
// name
file.name = level_json.at("long_name").get<std::string>();
ASSERT_MSG(file.name.size() <= 10,
fmt::format("long_name over 10 characters ({} characters): '{}'", file.name.size(),
file.name));
// nick
file.nickname = level_json.at("nickname").get<std::string>();
// vis infos
+3
View File
@@ -40,6 +40,9 @@ bool run_build_level(const std::string& input_file,
// unk zero
// name
file.name = level_json.at("long_name").get<std::string>();
ASSERT_MSG(file.name.size() <= 10,
fmt::format("long_name over 10 characters ({} characters): '{}'", file.name.size(),
file.name));
// nick
file.nickname = level_json.at("nickname").get<std::string>();
// vis infos