From c9522fb740200ccef6230cec452c48efb31e5394 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Thu, 11 May 2023 22:05:17 +0200 Subject: Removed all Printf-family functions from StringUtils. Replaced them with fmt::format calls, including changes to the format strings. Also changed the format strings to use FMT_STRING, so that the format is checked compile-time against the arguments. Also fixed code-style violations already present in the code. --- src/Map.cpp | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'src/Map.cpp') diff --git a/src/Map.cpp b/src/Map.cpp index c02cd80f8..9e3c364b1 100644 --- a/src/Map.cpp +++ b/src/Map.cpp @@ -23,29 +23,27 @@ cMap::cMap(unsigned int a_ID, cWorld * a_World): m_Scale(3), m_CenterX(0), m_CenterZ(0), - m_World(a_World) + m_World(a_World), + m_Name(fmt::format(FMT_STRING("map_{}"), m_ID)) { m_Data.assign(m_Width * m_Height, E_BASE_COLOR_TRANSPARENT); - - Printf(m_Name, "map_%i", m_ID); } -cMap::cMap(unsigned int a_ID, int a_CenterX, int a_CenterZ, cWorld * a_World, unsigned int a_Scale) - : m_ID(a_ID) - , m_Width(cChunkDef::Width * 8) - , m_Height(cChunkDef::Width * 8) - , m_Scale(a_Scale) - , m_CenterX(a_CenterX) - , m_CenterZ(a_CenterZ) - , m_World(a_World) +cMap::cMap(unsigned int a_ID, int a_CenterX, int a_CenterZ, cWorld * a_World, unsigned int a_Scale): + m_ID(a_ID), + m_Width(cChunkDef::Width * 8), + m_Height(cChunkDef::Width * 8), + m_Scale(a_Scale), + m_CenterX(a_CenterX), + m_CenterZ(a_CenterZ), + m_World(a_World), + m_Name(fmt::format(FMT_STRING("map_{}"), m_ID)) { m_Data.assign(m_Width * m_Height, E_BASE_COLOR_TRANSPARENT); - - Printf(m_Name, "map_%i", m_ID); } -- cgit v1.2.3