From 332983c97b7a729c4dc5f19aa9ee4a22c420f7d8 Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Tue, 27 Jun 2023 20:23:44 +1000 Subject: The Formatting String Catastrophe --- source/game/StarWorldClient.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source/game/StarWorldClient.cpp') diff --git a/source/game/StarWorldClient.cpp b/source/game/StarWorldClient.cpp index f04c70a..3e91779 100644 --- a/source/game/StarWorldClient.cpp +++ b/source/game/StarWorldClient.cpp @@ -641,18 +641,18 @@ void WorldClient::handleIncomingPackets(List const& packets) { for (auto const& packet : packets) { if (!inWorld() && !is(packet)) - Logger::error("WorldClient received packet type %s while not in world", PacketTypeNames.getRight(packet->type())); + Logger::error("WorldClient received packet type {} while not in world", PacketTypeNames.getRight(packet->type())); if (auto worldStartPacket = as(packet)) { initWorld(*worldStartPacket); } else if (auto worldStopPacket = as(packet)) { - Logger::info("Client received world stop packet, leaving: %s", worldStopPacket->reason); + Logger::info("Client received world stop packet, leaving: {}", worldStopPacket->reason); clearWorld(); } else if (auto entityCreate = as(packet)) { if (m_entityMap->entity(entityCreate->entityId)) { - Logger::error("WorldClient received entity create packet with duplicate entity id %s, deleting old entity.", entityCreate->entityId); + Logger::error("WorldClient received entity create packet with duplicate entity id {}, deleting old entity.", entityCreate->entityId); removeEntity(entityCreate->entityId, false); } @@ -867,7 +867,7 @@ void WorldClient::handleIncomingPackets(List const& packets) { m_latency = Time::monotonicMilliseconds() - m_pingTime.take(); } else { - Logger::error("Improper packet type %s received by client", (int)packet->type()); + Logger::error("Improper packet type {} received by client", (int)packet->type()); } } } @@ -1031,7 +1031,7 @@ void WorldClient::update() { renderCollisionDebug(); LogMap::set("client_entities", m_entityMap->size()); - LogMap::set("client_sectors", strf("%d", loadedSectors.size())); + LogMap::set("client_sectors", strf("{}", loadedSectors.size())); LogMap::set("client_lua_mem", m_luaRoot->luaMemoryUsage()); } @@ -1214,7 +1214,7 @@ void WorldClient::handleDamageNotifications() { return; Particle particle = Root::singleton().particleDatabase()->particle(damageNumberParticleKind); particle.position += position; - particle.string = particle.string.replace("$dmg$", strf("%s", displayValue)); + particle.string = particle.string.replace("$dmg$", strf("{}", displayValue)); m_particles->add(particle); }; -- cgit v1.2.3