move the shared TOML helpers into the utility namespace

The names are generic (makeError, requireInt, parseFile), and at global scope
with external linkage they would form an overload set with the same-named
anonymous-namespace helpers in VisualsLoader.cpp and BalancingConfig.cpp the
moment either file includes TomlHelpers.h — silently, since the signatures
differ. Namespacing keeps that door shut.

Call sites are qualified explicitly rather than pulled in with a using
directive, matching how utility::getRandomInt and friends are already called.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YHcUerKAZKWNvSKJxYKbnG
This commit is contained in:
2026-08-04 09:27:43 +02:00
parent 21eb6ad096
commit 2c9433cea6
10 changed files with 155 additions and 141 deletions

View File

@@ -13,6 +13,13 @@
// Shared TOML-parsing helpers used by two or more ConfigLoader per-domain
// loaders. Helpers used by exactly one domain stay local to that domain's
// .cpp file instead.
//
// Namespaced because the names are generic: VisualsLoader.cpp and
// BalancingConfig.cpp each have their own same-named helpers in anonymous
// namespaces, and unqualified globals here would form an overload set with
// them the moment either file includes this header.
namespace utility
{
// --- Error helpers ----------------------------------------------------------
@@ -59,3 +66,5 @@ std::vector<RecipeIngredient> parseIngredients(const toml::array& arr,
const std::string& path);
toml::table parseFile(const std::string& path, const std::string& file);
} // namespace utility