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/StarCelestialCoordinate.cpp | |
parent | 14b9689b6d4f4ad5276c88130dc6e449bedc0709 (diff) |
The Formatting String Catastrophe
Diffstat (limited to 'source/game/StarCelestialCoordinate.cpp')
-rw-r--r-- | source/game/StarCelestialCoordinate.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/source/game/StarCelestialCoordinate.cpp b/source/game/StarCelestialCoordinate.cpp index 3652718..70bd61d 100644 --- a/source/game/StarCelestialCoordinate.cpp +++ b/source/game/StarCelestialCoordinate.cpp @@ -31,11 +31,11 @@ CelestialCoordinate::CelestialCoordinate(Json const& variant) : CelestialCoordin m_satelliteOrbitNumber = lexicalCast<int>(plist.at(4)); if (m_planetaryOrbitNumber <= 0) - throw CelestialException(strf("Planetary body number out of range in '%s'", id)); + throw CelestialException(strf("Planetary body number out of range in '{}'", id)); if (m_satelliteOrbitNumber < 0) - throw CelestialException(strf("Satellite body number out of range in '%s'", id)); + throw CelestialException(strf("Satellite body number out of range in '{}'", id)); } catch (StarException const& e) { - throw CelestialException(strf("Error parsing CelestialCoordinate from '%s'", id), e); + throw CelestialException(strf("Error parsing CelestialCoordinate from '{}'", id), e); } } } else if (variant.isType(Json::Type::Object)) { @@ -44,7 +44,7 @@ CelestialCoordinate::CelestialCoordinate(Json const& variant) : CelestialCoordin m_satelliteOrbitNumber = variant.getInt("satellite", 0); } else if (!variant.isNull()) { throw CelestialException( - strf("Improper variant type %s trying to convert to SystemCoordinate", variant.typeName())); + strf("Improper variant type {} trying to convert to SystemCoordinate", variant.typeName())); } } @@ -153,12 +153,12 @@ std::ostream& operator<<(std::ostream& os, CelestialCoordinate const& coord) { if (coord.isNull()) { os << "null"; } else { - format(os, "%s:%s:%s", coord.m_location[0], coord.m_location[1], coord.m_location[2]); + format(os, "{}:{}:{}", coord.m_location[0], coord.m_location[1], coord.m_location[2]); if (coord.m_planetaryOrbitNumber) { - format(os, ":%s", coord.m_planetaryOrbitNumber); + format(os, ":{}", coord.m_planetaryOrbitNumber); if (coord.m_satelliteOrbitNumber) - format(os, ":%s", coord.m_satelliteOrbitNumber); + format(os, ":{}", coord.m_satelliteOrbitNumber); } } |