move the shared TOML helpers into the utility namespace to avoid name collisions

This commit is contained in:
2026-08-04 18:05:52 +02:00
parent c8ff7da345
commit 61634f6fd2
10 changed files with 155 additions and 141 deletions

View File

@@ -46,11 +46,11 @@ void validateUnlocks(const GameConfig& cfg)
{
if (valid.count(id) == 0)
{
throw makeError(file, gPath, "grants unknown " + kind + " '" + id + "'");
throw utility::makeError(file, gPath, "grants unknown " + kind + " '" + id + "'");
}
if (!granted.insert(id).second)
{
throw makeError(file, gPath,
throw utility::makeError(file, gPath,
"grants " + kind + " '" + id + "' which is already granted by another unlock group");
}
}
@@ -61,13 +61,13 @@ void validateUnlocks(const GameConfig& cfg)
const std::string gPath = "unlock '" + group.id + "'";
if (!groupIds.insert(group.id).second)
{
throw makeError(file, gPath, "duplicate unlock group id");
throw utility::makeError(file, gPath, "duplicate unlock group id");
}
if (group.ships.empty() && group.modules.empty()
&& group.buildings.empty() && group.recipes.empty())
{
throw makeError(file, gPath, "grants no items (must grant at least one)");
throw utility::makeError(file, gPath, "grants no items (must grant at least one)");
}
checkGrants(group.ships, shipIds, grantedShipIds, "ship", gPath);
@@ -83,7 +83,7 @@ void validateUnlocks(const GameConfig& cfg)
{
if (groupIds.count(req) == 0)
{
throw makeError(file, "unlock '" + group.id + "'.requires",
throw utility::makeError(file, "unlock '" + group.id + "'.requires",
"references unknown unlock group '" + req + "'");
}
}