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/BlockType.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/BlockType.cpp') diff --git a/src/BlockType.cpp b/src/BlockType.cpp index 63e2a2a24..40bb00f95 100644 --- a/src/BlockType.cpp +++ b/src/BlockType.cpp @@ -138,11 +138,11 @@ public: AString res; if (a_ItemDamage == -1) { - Printf(res, "%d", a_ItemType); + res = fmt::format(FMT_STRING("{}"), a_ItemType); } else { - Printf(res, "%d:%d", a_ItemType, a_ItemDamage); + res = fmt::format(FMT_STRING("{}:{}"), a_ItemType, a_ItemDamage); } return res; } @@ -260,9 +260,7 @@ AString ItemTypeToString(short a_ItemType) AString ItemToFullString(const cItem & a_Item) { - AString res; - Printf(res, "%s:%d * %d", ItemToString(a_Item).c_str(), a_Item.m_ItemDamage, a_Item.m_ItemCount); - return res; + return fmt::format(FMT_STRING("{}:{} * {}"), ItemToString(a_Item), a_Item.m_ItemDamage, a_Item.m_ItemCount); } -- cgit v1.2.3