Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/game/StarNameGenerator.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2023-06-27 20:23:44 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2023-06-27 20:23:44 +1000
commit332983c97b7a729c4dc5f19aa9ee4a22c420f7d8 (patch)
treefd9c441b796b522bdd5c7f8fbd32f51b8eff2a28 /source/game/StarNameGenerator.cpp
parent14b9689b6d4f4ad5276c88130dc6e449bedc0709 (diff)
The Formatting String Catastrophe
Diffstat (limited to 'source/game/StarNameGenerator.cpp')
-rw-r--r--source/game/StarNameGenerator.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/source/game/StarNameGenerator.cpp b/source/game/StarNameGenerator.cpp
index 44f1512..6dd2350 100644
--- a/source/game/StarNameGenerator.cpp
+++ b/source/game/StarNameGenerator.cpp
@@ -14,12 +14,12 @@ PatternedNameGenerator::PatternedNameGenerator() {
auto sourceConfig = assets->json(file);
if (m_markovSources.contains(sourceConfig.getString("name")))
- throw NameGeneratorException::format("Duplicate name source '%s', config file '%s'", sourceConfig.getString("name"), file);
+ throw NameGeneratorException::format("Duplicate name source '{}', config file '{}'", sourceConfig.getString("name"), file);
m_markovSources.insert(sourceConfig.getString("name"), makeMarkovSource(sourceConfig.getUInt("prefixSize", 1),
sourceConfig.getUInt("endSize", 1), jsonToStringList(sourceConfig.get("sourceNames"))));
} catch (std::exception const& e) {
- throw NameGeneratorException(strf("Error reading name source config %s", file), e);
+ throw NameGeneratorException(strf("Error reading name source config {}", file), e);
}
}
@@ -82,7 +82,7 @@ String PatternedNameGenerator::processRule(JsonArray const& rule, RandomSource&
result += entry.toString();
} else if (mode == "markov") {
if (!m_markovSources.contains(meta.getString("source")))
- throw NameGeneratorException::format("Unknown name source '%s'", meta.getString("source"));
+ throw NameGeneratorException::format("Unknown name source '{}'", meta.getString("source"));
auto source = m_markovSources.get(meta.getString("source"));
auto lengthRange = meta.getArray("targetLength");
@@ -104,7 +104,7 @@ String PatternedNameGenerator::processRule(JsonArray const& rule, RandomSource&
result += piece;
} else
- throw StarException::format("Unknown mode: %s", mode);
+ throw StarException::format("Unknown mode: {}", mode);
if (titleCase)
result = result.titleCase();