diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-06-27 20:23:44 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-06-27 20:23:44 +1000 |
commit | 332983c97b7a729c4dc5f19aa9ee4a22c420f7d8 (patch) | |
tree | fd9c441b796b522bdd5c7f8fbd32f51b8eff2a28 /source/game/StarObjectDatabase.cpp | |
parent | 14b9689b6d4f4ad5276c88130dc6e449bedc0709 (diff) |
The Formatting String Catastrophe
Diffstat (limited to 'source/game/StarObjectDatabase.cpp')
-rw-r--r-- | source/game/StarObjectDatabase.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/source/game/StarObjectDatabase.cpp b/source/game/StarObjectDatabase.cpp index 11c45c7..4c9a968 100644 --- a/source/game/StarObjectDatabase.cpp +++ b/source/game/StarObjectDatabase.cpp @@ -239,7 +239,7 @@ List<ObjectOrientationPtr> ObjectDatabase::parseOrientations(String const& path, for (auto space : orientation->spaces) orientation->anchors.append({TileLayer::Background, space, tilled, soil, anchorMaterial}); } else { - throw ObjectException(strf("Unknown anchor type: %s", anchorType)); + throw ObjectException(strf("Unknown anchor type: {}", anchorType)); } } @@ -315,11 +315,11 @@ ObjectDatabase::ObjectDatabase() { try { String name = assets->json(file).getString("objectName"); if (m_paths.contains(name)) - Logger::error("Object %s defined twice, second time from %s", name, file); + Logger::error("Object {} defined twice, second time from {}", name, file); else m_paths[name] = file; } catch (std::exception const& e) { - Logger::error("Error loading object file %s: %s", file, outputException(e, true)); + Logger::error("Error loading object file {}: {}", file, outputException(e, true)); } } } @@ -345,7 +345,7 @@ ObjectConfigPtr ObjectDatabase::getConfig(String const& objectName) const { [this](String const& objectName) -> ObjectConfigPtr { if (auto path = m_paths.maybe(objectName)) return readConfig(*path); - throw ObjectException(strf("No such object named '%s'", objectName)); + throw ObjectException(strf("No such object named '{}'", objectName)); }); } @@ -369,7 +369,7 @@ ObjectPtr ObjectDatabase::createObject(String const& objectName, Json const& par } else if (config->type == "physics") { return make_shared<PhysicsObject>(config, parameters); } else { - throw ObjectException(strf("Unknown objectType '%s' constructing object '%s'", config->type, objectName)); + throw ObjectException(strf("Unknown objectType '{}' constructing object '{}'", config->type, objectName)); } } @@ -545,7 +545,7 @@ ObjectConfigPtr ObjectDatabase::readConfig(String const& path) { return objectConfig; } catch (std::exception const& e) { - throw ObjectException::format("Error loading object '%s': %s", path, outputException(e, false)); + throw ObjectException::format("Error loading object '{}': {}", path, outputException(e, false)); } } |