From 1fc8ecb6f6b11b06cc0331bb7395611aa6d34b2d Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Mon, 6 Jun 2022 09:40:17 +0100 Subject: [PATCH] Add fmt::runtime annotations for C++20 support `fmt` requires non-contexpr format string arguments to be wrapped in `fmt::runtime` in C++20. --- Source/DiabloUI/selconn.cpp | 2 +- Source/DiabloUI/selgame.cpp | 8 +- Source/DiabloUI/selhero.cpp | 2 +- Source/appfat.cpp | 10 +- Source/automap.cpp | 8 +- Source/control.cpp | 26 ++--- Source/cursor.cpp | 2 +- Source/diablo.cpp | 4 +- Source/discord/discord.cpp | 6 +- Source/engine/render/text_render.cpp | 2 +- Source/inv.cpp | 2 +- Source/items.cpp | 142 +++++++++++++-------------- Source/monster.cpp | 8 +- Source/msg.cpp | 2 +- Source/multi.cpp | 6 +- Source/objects.cpp | 6 +- Source/options.cpp | 4 +- Source/panels/spell_book.cpp | 10 +- Source/panels/spell_list.cpp | 16 +-- Source/player.cpp | 2 +- Source/plrmsg.cpp | 2 +- Source/qol/chatlog.cpp | 4 +- Source/qol/itemlabels.cpp | 2 +- Source/qol/xpbar.cpp | 10 +- Source/quests.cpp | 2 +- Source/stores.cpp | 20 ++-- Source/trigs.cpp | 30 +++--- Source/utils/log.hpp | 2 +- 28 files changed, 170 insertions(+), 170 deletions(-) diff --git a/Source/DiabloUI/selconn.cpp b/Source/DiabloUI/selconn.cpp index 616f19ef1..3c93214d2 100644 --- a/Source/DiabloUI/selconn.cpp +++ b/Source/DiabloUI/selconn.cpp @@ -120,7 +120,7 @@ void SelconnFocus(int value) break; } - CopyUtf8(selconn_MaxPlayers, fmt::format(_("Players Supported: {:d}"), players), sizeof(selconn_MaxPlayers)); + CopyUtf8(selconn_MaxPlayers, fmt::format(fmt::runtime(_("Players Supported: {:d}")), players), sizeof(selconn_MaxPlayers)); CopyUtf8(selconn_Description, WordWrapString(selconn_Description, DESCRIPTION_WIDTH), sizeof(selconn_Description)); } diff --git a/Source/DiabloUI/selgame.cpp b/Source/DiabloUI/selgame.cpp index 1892b8310..e7dc26417 100644 --- a/Source/DiabloUI/selgame.cpp +++ b/Source/DiabloUI/selgame.cpp @@ -94,9 +94,9 @@ static std::string GetErrorMessageIncompatibility(const GameData &data) default: return std::string(_("The host is running a different game than you.")); } - return fmt::format(_("The host is running a different game mode ({:s}) than you."), gameMode); + return fmt::format(fmt::runtime(_("The host is running a different game mode ({:s}) than you.")), gameMode); } else { - return fmt::format(_(/* TRANSLATORS: Error message when somebody tries to join a game running another version. */ "Your version {:s} does not match the host {:d}.{:d}.{:d}."), PROJECT_VERSION, data.versionMajor, data.versionMinor, data.versionPatch); + return fmt::format(fmt::runtime(_(/* TRANSLATORS: Error message when somebody tries to join a game running another version. */ "Your version {:s} does not match the host {:d}.{:d}.{:d}.")), PROJECT_VERSION, data.versionMajor, data.versionMinor, data.versionPatch); } } @@ -235,7 +235,7 @@ void selgame_GameSelection_Focus(int value) difficulty = _("Hell"); break; } - infoString.append(fmt::format(_(/* TRANSLATORS: {:s} means: Game Difficulty. */ "Difficulty: {:s}"), difficulty)); + infoString.append(fmt::format(fmt::runtime(_(/* TRANSLATORS: {:s} means: Game Difficulty. */ "Difficulty: {:s}")), difficulty)); infoString.append("\n"); switch (gameInfo.gameData.nTickRate) { case 20: @@ -336,7 +336,7 @@ void selgame_GameSelection_Select(int value) break; } case 2: { - selgame_Title = fmt::format(_("Join {:s} Games"), _(ConnectionNames[provider])); + selgame_Title = fmt::format(fmt::runtime(_("Join {:s} Games")), _(ConnectionNames[provider])); title = selgame_Title.c_str(); const char *inputHint; diff --git a/Source/DiabloUI/selhero.cpp b/Source/DiabloUI/selhero.cpp index cd1107f99..cfc04f92e 100644 --- a/Source/DiabloUI/selhero.cpp +++ b/Source/DiabloUI/selhero.cpp @@ -564,7 +564,7 @@ static void UiSelHeroDialog( } else { CopyUtf8(dialogTitle, _("Delete Single Player Hero"), sizeof(dialogTitle)); } - strcpy(dialogText, fmt::format(_("Are you sure you want to delete the character \"{:s}\"?"), selhero_heroInfo.name).c_str()); + strcpy(dialogText, fmt::format(fmt::runtime(_("Are you sure you want to delete the character \"{:s}\"?")), selhero_heroInfo.name).c_str()); if (UiSelHeroYesNoDialog(dialogTitle, dialogText)) fnremove(&selhero_heroInfo); diff --git a/Source/appfat.cpp b/Source/appfat.cpp index a1c029ea3..98c379a98 100644 --- a/Source/appfat.cpp +++ b/Source/appfat.cpp @@ -92,7 +92,7 @@ void ErrDlg(const char *title, string_view error, string_view logFilePath, int l { FreeDlg(); - std::string text = fmt::format(_(/* TRANSLATORS: Error message that displays relevant information for bug report */ "{:s}\n\nThe error occurred at: {:s} line {:d}"), error, logFilePath, logLineNr); + std::string text = fmt::format(fmt::runtime(_(/* TRANSLATORS: Error message that displays relevant information for bug report */ "{:s}\n\nThe error occurred at: {:s} line {:d}")), error, logFilePath, logLineNr); UiErrorOkDialog(title, text); app_fatal(nullptr); @@ -101,9 +101,9 @@ void ErrDlg(const char *title, string_view error, string_view logFilePath, int l void InsertCDDlg(string_view archiveName) { std::string text = fmt::format( - _("Unable to open main data archive ({:s}).\n" - "\n" - "Make sure that it is in the game folder."), + fmt::runtime(_("Unable to open main data archive ({:s}).\n" + "\n" + "Make sure that it is in the game folder.")), archiveName); UiErrorOkDialog(_("Data File Error"), text); @@ -112,7 +112,7 @@ void InsertCDDlg(string_view archiveName) void DirErrorDlg(string_view error) { - std::string text = fmt::format(_(/* TRANSLATORS: Error when Program is not allowed to write data */ "Unable to write to location:\n{:s}"), error); + std::string text = fmt::format(fmt::runtime(_(/* TRANSLATORS: Error when Program is not allowed to write data */ "Unable to write to location:\n{:s}")), error); UiErrorOkDialog(_("Read-Only Directory Error"), text); app_fatal(nullptr); diff --git a/Source/automap.cpp b/Source/automap.cpp index 19060c4ab..8239bf5f6 100644 --- a/Source/automap.cpp +++ b/Source/automap.cpp @@ -506,13 +506,13 @@ void DrawAutomapText(const Surface &out) std::string description; switch (leveltype) { case DTYPE_NEST: - description = fmt::format(_("Level: Nest {:d}"), currlevel - 16); + description = fmt::format(fmt::runtime(_("Level: Nest {:d}")), currlevel - 16); break; case DTYPE_CRYPT: - description = fmt::format(_("Level: Crypt {:d}"), currlevel - 20); + description = fmt::format(fmt::runtime(_("Level: Crypt {:d}")), currlevel - 20); break; default: - description = fmt::format(_("Level: {:d}"), currlevel); + description = fmt::format(fmt::runtime(_("Level: {:d}")), currlevel); break; } @@ -532,7 +532,7 @@ void DrawAutomapText(const Surface &out) break; } - std::string description = fmt::format(_(/* TRANSLATORS: {:s} means: Game Difficulty. */ "Difficulty: {:s}"), difficulty); + std::string description = fmt::format(fmt::runtime(_(/* TRANSLATORS: {:s} means: Game Difficulty. */ "Difficulty: {:s}")), difficulty); DrawString(out, description, linePosition); } diff --git a/Source/control.cpp b/Source/control.cpp index 8025eb50b..fa78986fb 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -716,7 +716,7 @@ void CheckPanelInfo() InfoString = _("Player attack"); } if (PanBtnHotKey[i] != nullptr) { - AddPanelString(fmt::format(_("Hotkey: {:s}"), _(PanBtnHotKey[i]))); + AddPanelString(fmt::format(fmt::runtime(_("Hotkey: {:s}")), _(PanBtnHotKey[i]))); } InfoColor = UiFlags::ColorWhite; panelflag = true; @@ -732,24 +732,24 @@ void CheckPanelInfo() if (spellId != SPL_INVALID && spellId != SPL_NULL) { switch (myPlayer._pRSplType) { case RSPLTYPE_SKILL: - AddPanelString(fmt::format(_("{:s} Skill"), pgettext("spell", spelldata[spellId].sSkillText))); + AddPanelString(fmt::format(fmt::runtime(_("{:s} Skill")), pgettext("spell", spelldata[spellId].sSkillText))); break; case RSPLTYPE_SPELL: { - AddPanelString(fmt::format(_("{:s} Spell"), pgettext("spell", spelldata[spellId].sNameText))); + AddPanelString(fmt::format(fmt::runtime(_("{:s} Spell")), pgettext("spell", spelldata[spellId].sNameText))); int c = std::max(myPlayer._pISplLvlAdd + myPlayer._pSplLvl[spellId], 0); - AddPanelString(c == 0 ? _("Spell Level 0 - Unusable") : fmt::format(_("Spell Level {:d}"), c)); + AddPanelString(c == 0 ? _("Spell Level 0 - Unusable") : fmt::format(fmt::runtime(_("Spell Level {:d}")), c)); } break; case RSPLTYPE_SCROLL: { - AddPanelString(fmt::format(_("Scroll of {:s}"), pgettext("spell", spelldata[spellId].sNameText))); + AddPanelString(fmt::format(fmt::runtime(_("Scroll of {:s}")), pgettext("spell", spelldata[spellId].sNameText))); const InventoryAndBeltPlayerItemsRange items { myPlayer }; const int scrollCount = std::count_if(items.begin(), items.end(), [spellId](const Item &item) { return item.isScrollOf(spellId); }); - AddPanelString(fmt::format(ngettext("{:d} Scroll", "{:d} Scrolls", scrollCount), scrollCount)); + AddPanelString(fmt::format(fmt::runtime(ngettext("{:d} Scroll", "{:d} Scrolls", scrollCount)), scrollCount)); } break; case RSPLTYPE_CHARGES: - AddPanelString(fmt::format(_("Staff of {:s}"), pgettext("spell", spelldata[spellId].sNameText))); - AddPanelString(fmt::format(ngettext("{:d} Charge", "{:d} Charges", myPlayer.InvBody[INVLOC_HAND_LEFT]._iCharges), myPlayer.InvBody[INVLOC_HAND_LEFT]._iCharges)); + AddPanelString(fmt::format(fmt::runtime(_("Staff of {:s}")), pgettext("spell", spelldata[spellId].sNameText))); + AddPanelString(fmt::format(fmt::runtime(ngettext("{:d} Charge", "{:d} Charges", myPlayer.InvBody[INVLOC_HAND_LEFT]._iCharges)), myPlayer.InvBody[INVLOC_HAND_LEFT]._iCharges)); break; case RSPLTYPE_INVALID: break; @@ -878,7 +878,7 @@ void DrawInfoBox(const Surface &out) } else if (!myPlayer.HoldItem.isEmpty()) { if (myPlayer.HoldItem._itype == ItemType::Gold) { int nGold = myPlayer.HoldItem._ivalue; - InfoString = fmt::format(ngettext("{:d} gold piece", "{:d} gold pieces", nGold), nGold); + InfoString = fmt::format(fmt::runtime(ngettext("{:d} gold piece", "{:d} gold pieces", nGold)), nGold); } else if (!myPlayer.CanUseItem(myPlayer.HoldItem)) { InfoString = _("Requirements not met"); } else { @@ -914,8 +914,8 @@ void DrawInfoBox(const Surface &out) auto &target = Players[pcursplr]; InfoString = string_view(target._pName); ClearPanel(); - AddPanelString(fmt::format(_("{:s}, Level: {:d}"), _(ClassStrTbl[static_cast(target._pClass)]), target._pLevel)); - AddPanelString(fmt::format(_("Hit Points {:d} of {:d}"), target._pHitPoints >> 6, target._pMaxHP >> 6)); + AddPanelString(fmt::format(fmt::runtime(_("{:s}, Level: {:d}")), _(ClassStrTbl[static_cast(target._pClass)]), target._pLevel)); + AddPanelString(fmt::format(fmt::runtime(_("Hit Points {:d} of {:d}")), target._pHitPoints >> 6, target._pMaxHP >> 6)); } } if (!InfoString.empty() || pnumlines != 0) @@ -1055,11 +1055,11 @@ void DrawGoldSplit(const Surface &out, int amount) CelDrawTo(out, GetPanelPosition(UiPanels::Inventory, { dialogX, 178 }), *pGBoxBuff, 0); const std::string description = fmt::format( - ngettext( + fmt::runtime(ngettext( /* TRANSLATORS: {:d} is a number. Dialog is shown when splitting a stash of Gold.*/ "You have {:d} gold piece. How many do you want to remove?", "You have {:d} gold pieces. How many do you want to remove?", - initialDropGoldValue), + initialDropGoldValue)), initialDropGoldValue); // Pre-wrap the string at spaces, otherwise DrawString would hard wrap in the middle of words diff --git a/Source/cursor.cpp b/Source/cursor.cpp index b2e9f9d26..0acf62015 100644 --- a/Source/cursor.cpp +++ b/Source/cursor.cpp @@ -227,7 +227,7 @@ void CheckTown() trigflag = true; ClearPanel(); InfoString = _("Town Portal"); - AddPanelString(fmt::format(_("from {:s}"), Players[missile._misource]._pName)); + AddPanelString(fmt::format(fmt::runtime(_("from {:s}")), Players[missile._misource]._pName)); cursPosition = missile.position.tile; } } diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 64dbadedc..7787b23cf 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -992,7 +992,7 @@ void DiabloInitScreen() void SetApplicationVersions() { snprintf(gszProductName, sizeof(gszProductName) / sizeof(char), "%s v%s", PROJECT_NAME, PROJECT_VERSION); - CopyUtf8(gszVersionNumber, fmt::format(_("version {:s}"), PROJECT_VERSION), sizeof(gszVersionNumber) / sizeof(char)); + CopyUtf8(gszVersionNumber, fmt::format(fmt::runtime(_("version {:s}")), PROJECT_VERSION), sizeof(gszVersionNumber) / sizeof(char)); } void DiabloInit() @@ -1679,7 +1679,7 @@ void InitKeymapActions() 'V', [] { EventPlrMsg(fmt::format( - _(/* TRANSLATORS: {:s} means: Character Name, Game Version, Game Difficulty. */ "{:s} {:s}"), + fmt::runtime(_(/* TRANSLATORS: {:s} means: Character Name, Game Version, Game Difficulty. */ "{:s} {:s}")), PROJECT_NAME, PROJECT_VERSION), UiFlags::ColorWhite); diff --git a/Source/discord/discord.cpp b/Source/discord/discord.cpp index 027623fa4..4569e1a47 100644 --- a/Source/discord/discord.cpp +++ b/Source/discord/discord.cpp @@ -79,7 +79,7 @@ std::string GetLocationString() else if (tracked_data.dungeonArea == DTYPE_CRYPT) level -= 20; - return fmt::format(_(/* TRANSLATORS: dungeon type and floor number i.e. "Cathedral 3"*/ "{} {}"), dungeonStr, level); + return fmt::format(fmt::runtime(_(/* TRANSLATORS: dungeon type and floor number i.e. "Cathedral 3"*/ "{} {}")), dungeonStr, level); } return dungeonStr; } @@ -87,7 +87,7 @@ std::string GetLocationString() std::string GetCharacterString() { const string_view charClassStr = _(ClassStrTbl[static_cast(MyPlayer->_pClass)]); - return fmt::format(_(/* TRANSLATORS: Discord character, i.e. "Lv 6 Warrior" */ "Lv {} {}"), tracked_data.playerLevel, charClassStr); + return fmt::format(fmt::runtime(_(/* TRANSLATORS: Discord character, i.e. "Lv 6 Warrior" */ "Lv {} {}")), tracked_data.playerLevel, charClassStr); } std::string GetDetailString() @@ -99,7 +99,7 @@ std::string GetStateString() { constexpr std::array DifficultyStrs = { N_("Normal"), N_("Nightmare"), N_("Hell") }; const string_view difficultyStr = _(DifficultyStrs[sgGameInitInfo.nDifficulty]); - return fmt::format(_(/* TRANSLATORS: Discord state i.e. "Nightmare difficulty" */ "{} difficulty"), difficultyStr); + return fmt::format(fmt::runtime(_(/* TRANSLATORS: Discord state i.e. "Nightmare difficulty" */ "{} difficulty")), difficultyStr); } std::string GetTooltipString() diff --git a/Source/engine/render/text_render.cpp b/Source/engine/render/text_render.cpp index 40032f6c8..d89da7992 100644 --- a/Source/engine/render/text_render.cpp +++ b/Source/engine/render/text_render.cpp @@ -278,7 +278,7 @@ public: } else { if (!args_[*result].HasFormatted()) { const auto fmtStr = positional ? "{}" : fmt::string_view(rest.data(), fmtLen); - args_[*result].SetFormatted(fmt::format(fmtStr, args_[*result].GetIntValue())); + args_[*result].SetFormatted(fmt::format(fmt::runtime(fmtStr), args_[*result].GetIntValue())); } rest.remove_prefix(fmtLen); } diff --git a/Source/inv.cpp b/Source/inv.cpp index bb72debbd..276e3533d 100644 --- a/Source/inv.cpp +++ b/Source/inv.cpp @@ -1928,7 +1928,7 @@ int8_t CheckInvHLight() if (pi->_itype == ItemType::Gold) { int nGold = pi->_ivalue; - InfoString = fmt::format(ngettext("{:d} gold piece", "{:d} gold pieces", nGold), nGold); + InfoString = fmt::format(fmt::runtime(ngettext("{:d} gold piece", "{:d} gold pieces", nGold)), nGold); } else { InfoColor = pi->getTextColor(); if (pi->_iIdentified) { diff --git a/Source/items.cpp b/Source/items.cpp index 13761a7f4..65eef3c45 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -1107,17 +1107,17 @@ void GetStaffPower(Item &item, int lvl, int bs, bool onlygood) string_view spellName = pgettext("spell", spelldata[bs].sNameText); string_view normalFmt = pgettext("spell", /* TRANSLATORS: Constructs item names. Format: {Item} of {Spell}. Example: War Staff of Firewall */ "{0} of {1}"); - CopyUtf8(item._iName, fmt::format(normalFmt, baseName, spellName), sizeof(item._iName)); + CopyUtf8(item._iName, fmt::format(fmt::runtime(normalFmt), baseName, spellName), sizeof(item._iName)); if (!StringInPanel(item._iName)) { - CopyUtf8(item._iName, fmt::format(normalFmt, shortName, spellName), sizeof(item._iName)); + CopyUtf8(item._iName, fmt::format(fmt::runtime(normalFmt), shortName, spellName), sizeof(item._iName)); } if (preidx != -1) { string_view magicFmt = pgettext("spell", /* TRANSLATORS: Constructs item names. Format: {Prefix} {Item} of {Spell}. Example: King's War Staff of Firewall */ "{0} {1} of {2}"); string_view prefixName = _(ItemPrefixes[preidx].PLName); - CopyUtf8(item._iIName, fmt::format(magicFmt, prefixName, baseName, spellName), sizeof(item._iIName)); + CopyUtf8(item._iIName, fmt::format(fmt::runtime(magicFmt), prefixName, baseName, spellName), sizeof(item._iIName)); if (!StringInPanel(item._iIName)) { - CopyUtf8(item._iIName, fmt::format(magicFmt, prefixName, shortName, spellName), sizeof(item._iIName)); + CopyUtf8(item._iIName, fmt::format(fmt::runtime(magicFmt), prefixName, shortName, spellName), sizeof(item._iIName)); } } else { CopyUtf8(item._iIName, item._iName, sizeof(item._iIName)); @@ -1132,13 +1132,13 @@ std::string GenerateMagicItemName(const string_view &baseNamel, int preidx, int { if (preidx != -1 && sufidx != -1) { string_view fmt = _(/* TRANSLATORS: Constructs item names. Format: {Prefix} {Item} of {Suffix}. Example: King's Long Sword of the Whale */ "{0} {1} of {2}"); - return fmt::format(fmt, _(ItemPrefixes[preidx].PLName), baseNamel, _(ItemSuffixes[sufidx].PLName)); + return fmt::format(fmt::runtime(fmt), _(ItemPrefixes[preidx].PLName), baseNamel, _(ItemSuffixes[sufidx].PLName)); } else if (preidx != -1) { string_view fmt = _(/* TRANSLATORS: Constructs item names. Format: {Prefix} {Item}. Example: King's Long Sword */ "{0} {1}"); - return fmt::format(fmt, _(ItemPrefixes[preidx].PLName), baseNamel); + return fmt::format(fmt::runtime(fmt), _(ItemPrefixes[preidx].PLName), baseNamel); } else if (sufidx != -1) { string_view fmt = _(/* TRANSLATORS: Constructs item names. Format: {Item} of {Suffix}. Example: Long Sword of the Whale */ "{0} of {1}"); - return fmt::format(fmt, baseNamel, _(ItemSuffixes[sufidx].PLName)); + return fmt::format(fmt::runtime(fmt), baseNamel, _(ItemSuffixes[sufidx].PLName)); } return std::string(baseNamel); @@ -1835,7 +1835,7 @@ void PrintItemMisc(const Item &item) } } if (item._iMiscId == IMISC_EAR) { - AddPanelString(fmt::format(pgettext("player", "Level: {:d}"), item._ivalue)); + AddPanelString(fmt::format(fmt::runtime(pgettext("player", "Level: {:d}")), item._ivalue)); } if (item._iMiscId == IMISC_AURIC) { AddPanelString(_("Doubles gold capacity")); @@ -1851,11 +1851,11 @@ void PrintItemInfo(const Item &item) if (str != 0 || mag != 0 || dex != 0) { std::string text = std::string(_("Required:")); if (str != 0) - text.append(fmt::format(_(" {:d} Str"), str)); + text.append(fmt::format(fmt::runtime(_(" {:d} Str")), str)); if (mag != 0) - text.append(fmt::format(_(" {:d} Mag"), mag)); + text.append(fmt::format(fmt::runtime(_(" {:d} Mag")), mag)); if (dex != 0) - text.append(fmt::format(_(" {:d} Dex"), dex)); + text.append(fmt::format(fmt::runtime(_(" {:d} Dex")), dex)); AddPanelString(text); } } @@ -3221,7 +3221,7 @@ void RecreateEar(Item &item, uint16_t ic, int iseed, int id, int dur, int mdur, heroName[15] = static_cast(ibuff & 0x7F); heroName[16] = '\0'; - std::string itemName = fmt::format(_(/* TRANSLATORS: {:s} will be a Character Name */ "Ear of {:s}"), heroName); + std::string itemName = fmt::format(fmt::runtime(_(/* TRANSLATORS: {:s} will be a Character Name */ "Ear of {:s}")), heroName); CopyUtf8(item._iName, itemName, sizeof(item._iName)); CopyUtf8(item._iIName, heroName, sizeof(item._iIName)); @@ -3452,7 +3452,7 @@ void GetItemStr(Item &item) InfoColor = item.getTextColor(); } else { int nGold = item._ivalue; - InfoString = fmt::format(ngettext("{:d} gold piece", "{:d} gold pieces", nGold), nGold); + InfoString = fmt::format(fmt::runtime(ngettext("{:d} gold piece", "{:d} gold pieces", nGold)), nGold); } } @@ -3518,88 +3518,88 @@ bool DoOil(Player &player, int cii) switch (plidx) { case IPL_TOHIT: case IPL_TOHIT_CURSE: - return fmt::format(_("chance to hit: {:+d}%"), item._iPLToHit); + return fmt::format(fmt::runtime(_("chance to hit: {:+d}%")), item._iPLToHit); case IPL_DAMP: case IPL_DAMP_CURSE: - return fmt::format(_(/*xgettext:no-c-format*/ "{:+d}% damage"), item._iPLDam); + return fmt::format(fmt::runtime(_(/*xgettext:no-c-format*/ "{:+d}% damage")), item._iPLDam); case IPL_TOHIT_DAMP: case IPL_TOHIT_DAMP_CURSE: - return fmt::format(_("to hit: {:+d}%, {:+d}% damage"), item._iPLToHit, item._iPLDam); + return fmt::format(fmt::runtime(_("to hit: {:+d}%, {:+d}% damage")), item._iPLToHit, item._iPLDam); case IPL_ACP: case IPL_ACP_CURSE: - return fmt::format(_(/*xgettext:no-c-format*/ "{:+d}% armor"), item._iPLAC); + return fmt::format(fmt::runtime(_(/*xgettext:no-c-format*/ "{:+d}% armor")), item._iPLAC); case IPL_SETAC: case IPL_AC_CURSE: - return fmt::format(_("armor class: {:d}"), item._iAC); + return fmt::format(fmt::runtime(_("armor class: {:d}")), item._iAC); case IPL_FIRERES: case IPL_FIRERES_CURSE: if (item._iPLFR < MAXRESIST) - return fmt::format(_("Resist Fire: {:+d}%"), item._iPLFR); + return fmt::format(fmt::runtime(_("Resist Fire: {:+d}%")), item._iPLFR); else - return fmt::format(_("Resist Fire: {:+d}% MAX"), MAXRESIST); + return fmt::format(fmt::runtime(_("Resist Fire: {:+d}% MAX")), MAXRESIST); case IPL_LIGHTRES: case IPL_LIGHTRES_CURSE: if (item._iPLLR < MAXRESIST) - return fmt::format(_("Resist Lightning: {:+d}%"), item._iPLLR); + return fmt::format(fmt::runtime(_("Resist Lightning: {:+d}%")), item._iPLLR); else - return fmt::format(_("Resist Lightning: {:+d}% MAX"), MAXRESIST); + return fmt::format(fmt::runtime(_("Resist Lightning: {:+d}% MAX")), MAXRESIST); case IPL_MAGICRES: case IPL_MAGICRES_CURSE: if (item._iPLMR < MAXRESIST) - return fmt::format(_("Resist Magic: {:+d}%"), item._iPLMR); + return fmt::format(fmt::runtime(_("Resist Magic: {:+d}%")), item._iPLMR); else - return fmt::format(_("Resist Magic: {:+d}% MAX"), MAXRESIST); + return fmt::format(fmt::runtime(_("Resist Magic: {:+d}% MAX")), MAXRESIST); case IPL_ALLRES: case IPL_ALLRES_CURSE: if (item._iPLFR < MAXRESIST) - return fmt::format(_("Resist All: {:+d}%"), item._iPLFR); + return fmt::format(fmt::runtime(_("Resist All: {:+d}%")), item._iPLFR); else - return fmt::format(_("Resist All: {:+d}% MAX"), MAXRESIST); + return fmt::format(fmt::runtime(_("Resist All: {:+d}% MAX")), MAXRESIST); case IPL_SPLLVLADD: if (item._iSplLvlAdd > 0) - return fmt::format(ngettext("spells are increased {:d} level", "spells are increased {:d} levels", item._iSplLvlAdd), item._iSplLvlAdd); + return fmt::format(fmt::runtime(ngettext("spells are increased {:d} level", "spells are increased {:d} levels", item._iSplLvlAdd)), item._iSplLvlAdd); else if (item._iSplLvlAdd < 0) - return fmt::format(ngettext("spells are decreased {:d} level", "spells are decreased {:d} levels", -item._iSplLvlAdd), -item._iSplLvlAdd); + return fmt::format(fmt::runtime(ngettext("spells are decreased {:d} level", "spells are decreased {:d} levels", -item._iSplLvlAdd)), -item._iSplLvlAdd); else return _("spell levels unchanged (?)"); case IPL_CHARGES: return _("Extra charges"); case IPL_SPELL: - return fmt::format(ngettext("{:d} {:s} charge", "{:d} {:s} charges", item._iMaxCharges), item._iMaxCharges, pgettext("spell", spelldata[item._iSpell].sNameText)); + return fmt::format(fmt::runtime(ngettext("{:d} {:s} charge", "{:d} {:s} charges", item._iMaxCharges)), item._iMaxCharges, pgettext("spell", spelldata[item._iSpell].sNameText)); case IPL_FIREDAM: if (item._iFMinDam == item._iFMaxDam) - return fmt::format(_("Fire hit damage: {:d}"), item._iFMinDam); + return fmt::format(fmt::runtime(_("Fire hit damage: {:d}")), item._iFMinDam); else - return fmt::format(_("Fire hit damage: {:d}-{:d}"), item._iFMinDam, item._iFMaxDam); + return fmt::format(fmt::runtime(_("Fire hit damage: {:d}-{:d}")), item._iFMinDam, item._iFMaxDam); case IPL_LIGHTDAM: if (item._iLMinDam == item._iLMaxDam) - return fmt::format(_("Lightning hit damage: {:d}"), item._iLMinDam); + return fmt::format(fmt::runtime(_("Lightning hit damage: {:d}")), item._iLMinDam); else - return fmt::format(_("Lightning hit damage: {:d}-{:d}"), item._iLMinDam, item._iLMaxDam); + return fmt::format(fmt::runtime(_("Lightning hit damage: {:d}-{:d}")), item._iLMinDam, item._iLMaxDam); case IPL_STR: case IPL_STR_CURSE: - return fmt::format(_("{:+d} to strength"), item._iPLStr); + return fmt::format(fmt::runtime(_("{:+d} to strength")), item._iPLStr); case IPL_MAG: case IPL_MAG_CURSE: - return fmt::format(_("{:+d} to magic"), item._iPLMag); + return fmt::format(fmt::runtime(_("{:+d} to magic")), item._iPLMag); case IPL_DEX: case IPL_DEX_CURSE: - return fmt::format(_("{:+d} to dexterity"), item._iPLDex); + return fmt::format(fmt::runtime(_("{:+d} to dexterity")), item._iPLDex); case IPL_VIT: case IPL_VIT_CURSE: - return fmt::format(_("{:+d} to vitality"), item._iPLVit); + return fmt::format(fmt::runtime(_("{:+d} to vitality")), item._iPLVit); case IPL_ATTRIBS: case IPL_ATTRIBS_CURSE: - return fmt::format(_("{:+d} to all attributes"), item._iPLStr); + return fmt::format(fmt::runtime(_("{:+d} to all attributes")), item._iPLStr); case IPL_GETHIT_CURSE: case IPL_GETHIT: - return fmt::format(_("{:+d} damage from enemies"), item._iPLGetHit); + return fmt::format(fmt::runtime(_("{:+d} damage from enemies")), item._iPLGetHit); case IPL_LIFE: case IPL_LIFE_CURSE: - return fmt::format(_("Hit Points: {:+d}"), item._iPLHP >> 6); + return fmt::format(fmt::runtime(_("Hit Points: {:+d}")), item._iPLHP >> 6); case IPL_MANA: case IPL_MANA_CURSE: - return fmt::format(_("Mana: {:+d}"), item._iPLMana >> 6); + return fmt::format(fmt::runtime(_("Mana: {:+d}")), item._iPLMana >> 6); case IPL_DUR: return _("high durability"); case IPL_DUR_CURSE: @@ -3607,26 +3607,26 @@ bool DoOil(Player &player, int cii) case IPL_INDESTRUCTIBLE: return _("indestructible"); case IPL_LIGHT: - return fmt::format(_(/*xgettext:no-c-format*/ "+{:d}% light radius"), 10 * item._iPLLight); + return fmt::format(fmt::runtime(_(/*xgettext:no-c-format*/ "+{:d}% light radius")), 10 * item._iPLLight); case IPL_LIGHT_CURSE: - return fmt::format(_(/*xgettext:no-c-format*/ "-{:d}% light radius"), -10 * item._iPLLight); + return fmt::format(fmt::runtime(_(/*xgettext:no-c-format*/ "-{:d}% light radius")), -10 * item._iPLLight); case IPL_MULT_ARROWS: return _("multiple arrows per shot"); case IPL_FIRE_ARROWS: if (item._iFMinDam == item._iFMaxDam) - return fmt::format(_("fire arrows damage: {:d}"), item._iFMinDam); + return fmt::format(fmt::runtime(_("fire arrows damage: {:d}")), item._iFMinDam); else - return fmt::format(_("fire arrows damage: {:d}-{:d}"), item._iFMinDam, item._iFMaxDam); + return fmt::format(fmt::runtime(_("fire arrows damage: {:d}-{:d}")), item._iFMinDam, item._iFMaxDam); case IPL_LIGHT_ARROWS: if (item._iLMinDam == item._iLMaxDam) - return fmt::format(_("lightning arrows damage {:d}"), item._iLMinDam); + return fmt::format(fmt::runtime(_("lightning arrows damage {:d}")), item._iLMinDam); else - return fmt::format(_("lightning arrows damage {:d}-{:d}"), item._iLMinDam, item._iLMaxDam); + return fmt::format(fmt::runtime(_("lightning arrows damage {:d}-{:d}")), item._iLMinDam, item._iLMaxDam); case IPL_FIREBALL: if (item._iFMinDam == item._iFMaxDam) - return fmt::format(_("fireball damage: {:d}"), item._iFMinDam); + return fmt::format(fmt::runtime(_("fireball damage: {:d}")), item._iFMinDam); else - return fmt::format(_("fireball damage: {:d}-{:d}"), item._iFMinDam, item._iFMaxDam); + return fmt::format(fmt::runtime(_("fireball damage: {:d}-{:d}")), item._iFMinDam, item._iFMaxDam); case IPL_THORNS: return _("attacker takes 1-3 damage"); case IPL_NOMANA: @@ -3678,7 +3678,7 @@ bool DoOil(Player &player, int cii) case IPL_FASTBLOCK: return _("fast block"); case IPL_DAMMOD: - return fmt::format(ngettext("adds {:d} point to damage", "adds {:d} points to damage", item._iPLDamMod), item._iPLDamMod); + return fmt::format(fmt::runtime(ngettext("adds {:d} point to damage", "adds {:d} points to damage", item._iPLDamMod)), item._iPLDamMod); case IPL_RNDARROWVEL: return _("fires random speed arrows"); case IPL_SETDAM: @@ -3701,28 +3701,28 @@ bool DoOil(Player &player, int cii) return { string_view(" ") }; case IPL_ADDACLIFE: if (item._iFMinDam == item._iFMaxDam) - return fmt::format(_("lightning damage: {:d}"), item._iFMinDam); + return fmt::format(fmt::runtime(_("lightning damage: {:d}")), item._iFMinDam); else - return fmt::format(_("lightning damage: {:d}-{:d}"), item._iFMinDam, item._iFMaxDam); + return fmt::format(fmt::runtime(_("lightning damage: {:d}-{:d}")), item._iFMinDam, item._iFMaxDam); case IPL_ADDMANAAC: return _("charged bolts on hits"); case IPL_FIRERESCLVL: if (item._iPLFR > 0) - return fmt::format(_("Resist Fire: {:+d}%"), item._iPLFR); + return fmt::format(fmt::runtime(_("Resist Fire: {:+d}%")), item._iPLFR); else return { string_view(" ") }; case IPL_DEVASTATION: return _("occasional triple damage"); case IPL_DECAY: - return fmt::format(_(/*xgettext:no-c-format*/ "decaying {:+d}% damage"), item._iPLDam); + return fmt::format(fmt::runtime(_(/*xgettext:no-c-format*/ "decaying {:+d}% damage")), item._iPLDam); case IPL_PERIL: return _("2x dmg to monst, 1x to you"); case IPL_JESTERS: return std::string(_(/*xgettext:no-c-format*/ "Random 0 - 500% damage")); case IPL_CRYSTALLINE: - return fmt::format(_(/*xgettext:no-c-format*/ "low dur, {:+d}% damage"), item._iPLDam); + return fmt::format(fmt::runtime(_(/*xgettext:no-c-format*/ "low dur, {:+d}% damage")), item._iPLDam); case IPL_DOPPELGANGER: - return fmt::format(_("to hit: {:+d}%, {:+d}% damage"), item._iPLToHit, item._iPLDam); + return fmt::format(fmt::runtime(_("to hit: {:+d}%, {:+d}% damage")), item._iPLToHit, item._iPLDam); case IPL_ACDEMON: return _("extra AC vs demons"); case IPL_ACUNDEAD: @@ -3767,24 +3767,24 @@ void PrintItemDetails(const Item &item) if (item._iClass == ICLASS_WEAPON) { if (item._iMinDam == item._iMaxDam) { if (item._iMaxDur == DUR_INDESTRUCTIBLE) - AddPanelString(fmt::format(_("damage: {:d} Indestructible"), item._iMinDam)); + AddPanelString(fmt::format(fmt::runtime(_("damage: {:d} Indestructible")), item._iMinDam)); else - AddPanelString(fmt::format(_(/* TRANSLATORS: Dur: is durability */ "damage: {:d} Dur: {:d}/{:d}"), item._iMinDam, item._iDurability, item._iMaxDur)); + AddPanelString(fmt::format(fmt::runtime(_(/* TRANSLATORS: Dur: is durability */ "damage: {:d} Dur: {:d}/{:d}")), item._iMinDam, item._iDurability, item._iMaxDur)); } else { if (item._iMaxDur == DUR_INDESTRUCTIBLE) - AddPanelString(fmt::format(_("damage: {:d}-{:d} Indestructible"), item._iMinDam, item._iMaxDam)); + AddPanelString(fmt::format(fmt::runtime(_("damage: {:d}-{:d} Indestructible")), item._iMinDam, item._iMaxDam)); else - AddPanelString(fmt::format(_(/* TRANSLATORS: Dur: is durability */ "damage: {:d}-{:d} Dur: {:d}/{:d}"), item._iMinDam, item._iMaxDam, item._iDurability, item._iMaxDur)); + AddPanelString(fmt::format(fmt::runtime(_(/* TRANSLATORS: Dur: is durability */ "damage: {:d}-{:d} Dur: {:d}/{:d}")), item._iMinDam, item._iMaxDam, item._iDurability, item._iMaxDur)); } } if (item._iClass == ICLASS_ARMOR) { if (item._iMaxDur == DUR_INDESTRUCTIBLE) - AddPanelString(fmt::format(_("armor: {:d} Indestructible"), item._iAC)); + AddPanelString(fmt::format(fmt::runtime(_("armor: {:d} Indestructible")), item._iAC)); else - AddPanelString(fmt::format(_(/* TRANSLATORS: Dur: is durability */ "armor: {:d} Dur: {:d}/{:d}"), item._iAC, item._iDurability, item._iMaxDur)); + AddPanelString(fmt::format(fmt::runtime(_(/* TRANSLATORS: Dur: is durability */ "armor: {:d} Dur: {:d}/{:d}")), item._iAC, item._iDurability, item._iMaxDur)); } if (item._iMiscId == IMISC_STAFF && item._iMaxCharges != 0) { - AddPanelString(fmt::format(_("Charges: {:d}/{:d}"), item._iCharges, item._iMaxCharges)); + AddPanelString(fmt::format(fmt::runtime(_("Charges: {:d}/{:d}")), item._iCharges, item._iMaxCharges)); } if (item._iPrePower != -1) { AddPanelString(PrintItemPower(item._iPrePower, item)); @@ -3805,30 +3805,30 @@ void PrintItemDur(const Item &item) if (item._iClass == ICLASS_WEAPON) { if (item._iMinDam == item._iMaxDam) { if (item._iMaxDur == DUR_INDESTRUCTIBLE) - AddPanelString(fmt::format(_("damage: {:d} Indestructible"), item._iMinDam)); + AddPanelString(fmt::format(fmt::runtime(_("damage: {:d} Indestructible")), item._iMinDam)); else - AddPanelString(fmt::format(_("damage: {:d} Dur: {:d}/{:d}"), item._iMinDam, item._iDurability, item._iMaxDur)); + AddPanelString(fmt::format(fmt::runtime(_("damage: {:d} Dur: {:d}/{:d}")), item._iMinDam, item._iDurability, item._iMaxDur)); } else { if (item._iMaxDur == DUR_INDESTRUCTIBLE) - AddPanelString(fmt::format(_("damage: {:d}-{:d} Indestructible"), item._iMinDam, item._iMaxDam)); + AddPanelString(fmt::format(fmt::runtime(_("damage: {:d}-{:d} Indestructible")), item._iMinDam, item._iMaxDam)); else - AddPanelString(fmt::format(_("damage: {:d}-{:d} Dur: {:d}/{:d}"), item._iMinDam, item._iMaxDam, item._iDurability, item._iMaxDur)); + AddPanelString(fmt::format(fmt::runtime(_("damage: {:d}-{:d} Dur: {:d}/{:d}")), item._iMinDam, item._iMaxDam, item._iDurability, item._iMaxDur)); } if (item._iMiscId == IMISC_STAFF && item._iMaxCharges > 0) { - AddPanelString(fmt::format(_("Charges: {:d}/{:d}"), item._iCharges, item._iMaxCharges)); + AddPanelString(fmt::format(fmt::runtime(_("Charges: {:d}/{:d}")), item._iCharges, item._iMaxCharges)); } if (item._iMagical != ITEM_QUALITY_NORMAL) AddPanelString(_("Not Identified")); } if (item._iClass == ICLASS_ARMOR) { if (item._iMaxDur == DUR_INDESTRUCTIBLE) - AddPanelString(fmt::format(_("armor: {:d} Indestructible"), item._iAC)); + AddPanelString(fmt::format(fmt::runtime(_("armor: {:d} Indestructible")), item._iAC)); else - AddPanelString(fmt::format(_("armor: {:d} Dur: {:d}/{:d}"), item._iAC, item._iDurability, item._iMaxDur)); + AddPanelString(fmt::format(fmt::runtime(_("armor: {:d} Dur: {:d}/{:d}")), item._iAC, item._iDurability, item._iMaxDur)); if (item._iMagical != ITEM_QUALITY_NORMAL) AddPanelString(_("Not Identified")); if (item._iMiscId == IMISC_STAFF && item._iMaxCharges > 0) { - AddPanelString(fmt::format(_("Charges: {:d}/{:d}"), item._iCharges, item._iMaxCharges)); + AddPanelString(fmt::format(fmt::runtime(_("Charges: {:d}/{:d}")), item._iCharges, item._iMaxCharges)); } } if (IsAnyOf(item._itype, ItemType::Ring, ItemType::Amulet)) diff --git a/Source/monster.cpp b/Source/monster.cpp index 812100343..4e2ee8ef7 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -4615,9 +4615,9 @@ void M_FallenFear(Point position) void PrintMonstHistory(int mt) { if (*sgOptions.Gameplay.showMonsterType) { - AddPanelString(fmt::format(_("Type: {:s} Kills: {:d}"), GetMonsterTypeText(MonstersData[mt]), MonsterKillCounts[mt])); + AddPanelString(fmt::format(fmt::runtime(_("Type: {:s} Kills: {:d}")), GetMonsterTypeText(MonstersData[mt]), MonsterKillCounts[mt])); } else { - AddPanelString(fmt::format(_("Total kills: {:d}"), MonsterKillCounts[mt])); + AddPanelString(fmt::format(fmt::runtime(_("Total kills: {:d}")), MonsterKillCounts[mt])); } if (MonsterKillCounts[mt] >= 30) { @@ -4649,7 +4649,7 @@ void PrintMonstHistory(int mt) minHP = 4 * minHP + hpBonusHell; maxHP = 4 * maxHP + hpBonusHell; } - AddPanelString(fmt::format(_("Hit Points: {:d}-{:d}"), minHP, maxHP)); + AddPanelString(fmt::format(fmt::runtime(_("Hit Points: {:d}-{:d}")), minHP, maxHP)); } if (MonsterKillCounts[mt] >= 15) { int res = (sgGameInitInfo.nDifficulty != DIFF_HELL) ? MonstersData[mt].mMagicRes : MonstersData[mt].mMagicRes2; @@ -4684,7 +4684,7 @@ void PrintUniqueHistory() { auto &monster = Monsters[pcursmonst]; if (*sgOptions.Gameplay.showMonsterType) { - AddPanelString(fmt::format(_("Type: {:s}"), GetMonsterTypeText(*monster.MData))); + AddPanelString(fmt::format(fmt::runtime(_("Type: {:s}")), GetMonsterTypeText(*monster.MData))); } int res = monster.mMagicRes & (RESIST_MAGIC | RESIST_FIRE | RESIST_LIGHTNING | IMMUNE_MAGIC | IMMUNE_FIRE | IMMUNE_LIGHTNING); diff --git a/Source/msg.cpp b/Source/msg.cpp index 8e4faf3bb..b5f9535ed 100644 --- a/Source/msg.cpp +++ b/Source/msg.cpp @@ -1732,7 +1732,7 @@ DWORD OnPlayerJoinLevel(const TCmd *pCmd, int pnum) ResetPlayerGFX(player); player.plractive = true; gbActivePlayers++; - EventPlrMsg(fmt::format(_("Player '{:s}' (level {:d}) just joined the game"), player._pName, player._pLevel)); + EventPlrMsg(fmt::format(fmt::runtime(_("Player '{:s}' (level {:d}) just joined the game")), player._pName, player._pLevel)); } if (player.plractive && MyPlayerId != pnum) { diff --git a/Source/multi.cpp b/Source/multi.cpp index 5d569ed49..b6e4b5dcc 100644 --- a/Source/multi.cpp +++ b/Source/multi.cpp @@ -252,7 +252,7 @@ void PlayerLeftMsg(int pnum, bool left) pszFmt = _("Player '{:s}' dropped due to timeout"); break; } - EventPlrMsg(fmt::format(pszFmt, player._pName)); + EventPlrMsg(fmt::format(fmt::runtime(pszFmt), player._pName)); } player.plractive = false; player._pName[0] = '\0'; @@ -775,7 +775,7 @@ bool NetInit(bool bSinglePlayer) Player &myPlayer = *MyPlayer; // separator for marking messages from a different game AddMessageToChatLog(_("New Game"), nullptr, UiFlags::ColorRed); - AddMessageToChatLog(fmt::format(_("Player '{:s}' (level {:d}) just joined the game"), myPlayer._pName, myPlayer._pLevel)); + AddMessageToChatLog(fmt::format(fmt::runtime(_("Player '{:s}' (level {:d}) just joined the game")), myPlayer._pName, myPlayer._pLevel)); return true; } @@ -829,7 +829,7 @@ void recv_plrinfo(int pnum, const TCmdPlrInfoHdr &header, bool recv) } else { szEvent = _("Player '{:s}' (level {:d}) is already in the game"); } - EventPlrMsg(fmt::format(szEvent, player._pName, player._pLevel)); + EventPlrMsg(fmt::format(fmt::runtime(szEvent), player._pName, player._pLevel)); SyncInitPlr(pnum); diff --git a/Source/objects.cpp b/Source/objects.cpp index a7947fb27..35be7c9b5 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -5567,7 +5567,7 @@ void GetObjectStr(const Object &object) break; case OBJ_SHRINEL: case OBJ_SHRINER: - InfoString = fmt::format(_(/* TRANSLATORS: {:s} will be a name from the Shrine block above */ "{:s} Shrine"), _(ShrineNames[object._oVar1])); + InfoString = fmt::format(fmt::runtime(_(/* TRANSLATORS: {:s} will be a name from the Shrine block above */ "{:s} Shrine")), _(ShrineNames[object._oVar1])); break; case OBJ_SKELBOOK: InfoString = _("Skeleton Tome"); @@ -5636,12 +5636,12 @@ void GetObjectStr(const Object &object) } if (MyPlayer->_pClass == HeroClass::Rogue) { if (object._oTrapFlag) { - InfoString = fmt::format(_(/* TRANSLATORS: {:s} will either be a chest or a door */ "Trapped {:s}"), InfoString); + InfoString = fmt::format(fmt::runtime(_(/* TRANSLATORS: {:s} will either be a chest or a door */ "Trapped {:s}")), InfoString); InfoColor = UiFlags::ColorRed; } } if (object.IsDisabled()) { - InfoString = fmt::format(_(/* TRANSLATORS: If user enabled diablo.ini setting "Disable Crippling Shrines" is set to 1; also used for Na-Kruls leaver */ "{:s} (disabled)"), InfoString); + InfoString = fmt::format(fmt::runtime(_(/* TRANSLATORS: If user enabled diablo.ini setting "Disable Crippling Shrines" is set to 1; also used for Na-Kruls leaver */ "{:s} (disabled))")), InfoString); InfoColor = UiFlags::ColorRed; } } diff --git a/Source/options.cpp b/Source/options.cpp index 03e0c1473..01242e9b2 100644 --- a/Source/options.cpp +++ b/Source/options.cpp @@ -1244,7 +1244,7 @@ KeymapperOptions::Action::Action(string_view key, string_view name, string_view , dynamicIndex(index) { if (index != 0) { - dynamicKey = fmt::format(fmt::string_view(key.data(), key.size()), index); + dynamicKey = fmt::format(fmt::runtime(fmt::string_view(key.data(), key.size())), index); this->key = dynamicKey; } } @@ -1253,7 +1253,7 @@ string_view KeymapperOptions::Action::GetName() const { if (dynamicIndex == 0) return _(name.data()); - dynamicName = fmt::format(_(name.data()), dynamicIndex); + dynamicName = fmt::format(fmt::runtime(_(name.data())), dynamicIndex); return dynamicName; } diff --git a/Source/panels/spell_book.cpp b/Source/panels/spell_book.cpp index 499927d8c..0f9ce7862 100644 --- a/Source/panels/spell_book.cpp +++ b/Source/panels/spell_book.cpp @@ -156,12 +156,12 @@ void DrawSpellBook(const Surface &out) break; case RSPLTYPE_CHARGES: { int charges = player.InvBody[INVLOC_HAND_LEFT]._iCharges; - PrintSBookStr(out, line1, fmt::format(ngettext("Staff ({:d} charge)", "Staff ({:d} charges)", charges), charges)); + PrintSBookStr(out, line1, fmt::format(fmt::runtime(ngettext("Staff ({:d} charge)", "Staff ({:d} charges)", charges)), charges)); } break; default: { int mana = GetManaAmount(player, sn) >> 6; int lvl = std::max(player._pSplLvl[sn] + player._pISplLvlAdd, 0); - PrintSBookStr(out, line0, fmt::format(pgettext(/* TRANSLATORS: UI constraints, keep short please.*/ "spellbook", "Level {:d}"), lvl), UiFlags::AlignRight); + PrintSBookStr(out, line0, fmt::format(fmt::runtime(pgettext(/* TRANSLATORS: UI constraints, keep short please.*/ "spellbook", "Level {:d}")), lvl), UiFlags::AlignRight); if (lvl == 0) { PrintSBookStr(out, line1, _("Unusable"), UiFlags::AlignRight); } else { @@ -171,15 +171,15 @@ void DrawSpellBook(const Surface &out) GetDamageAmt(sn, &min, &max); if (min != -1) { if (sn == SPL_HEAL || sn == SPL_HEALOTHER) { - PrintSBookStr(out, line1, fmt::format(_(/* TRANSLATORS: UI constraints, keep short please.*/ "Heals: {:d} - {:d}"), min, max), UiFlags::AlignRight); + PrintSBookStr(out, line1, fmt::format(fmt::runtime(_(/* TRANSLATORS: UI constraints, keep short please.*/ "Heals: {:d} - {:d}")), min, max), UiFlags::AlignRight); } else { - PrintSBookStr(out, line1, fmt::format(_(/* TRANSLATORS: UI constraints, keep short please.*/ "Damage: {:d} - {:d}"), min, max), UiFlags::AlignRight); + PrintSBookStr(out, line1, fmt::format(fmt::runtime(_(/* TRANSLATORS: UI constraints, keep short please.*/ "Damage: {:d} - {:d}")), min, max), UiFlags::AlignRight); } } } else { PrintSBookStr(out, line1, _(/* TRANSLATORS: UI constraints, keep short please.*/ "Dmg: 1/3 target hp"), UiFlags::AlignRight); } - PrintSBookStr(out, line1, fmt::format(pgettext(/* TRANSLATORS: UI constraints, keep short please.*/ "spellbook", "Mana: {:d}"), mana)); + PrintSBookStr(out, line1, fmt::format(fmt::runtime(pgettext(/* TRANSLATORS: UI constraints, keep short please.*/ "spellbook", "Mana: {:d}")), mana)); } } break; } diff --git a/Source/panels/spell_list.cpp b/Source/panels/spell_list.cpp index ddbddc6bc..97efc63d3 100644 --- a/Source/panels/spell_list.cpp +++ b/Source/panels/spell_list.cpp @@ -160,48 +160,48 @@ void DrawSpellList(const Surface &out) case RSPLTYPE_SKILL: spellColor = PAL16_YELLOW - 46; PrintSBookSpellType(out, spellListItem.location, _("Skill"), spellColor); - InfoString = fmt::format(_("{:s} Skill"), pgettext("spell", spellDataItem.sSkillText)); + InfoString = fmt::format(fmt::runtime(_("{:s} Skill")), pgettext("spell", spellDataItem.sSkillText)); break; case RSPLTYPE_SPELL: if (myPlayer.plrlevel != 0) { spellColor = PAL16_BLUE + 5; } PrintSBookSpellType(out, spellListItem.location, _("Spell"), spellColor); - InfoString = fmt::format(_("{:s} Spell"), pgettext("spell", spellDataItem.sNameText)); + InfoString = fmt::format(fmt::runtime(_("{:s} Spell")), pgettext("spell", spellDataItem.sNameText)); if (spellId == SPL_HBOLT) { AddPanelString(_("Damages undead only")); } if (spellLevel == 0) AddPanelString(_("Spell Level 0 - Unusable")); else - AddPanelString(fmt::format(_("Spell Level {:d}"), spellLevel)); + AddPanelString(fmt::format(fmt::runtime(_("Spell Level {:d}")), spellLevel)); break; case RSPLTYPE_SCROLL: { if (myPlayer.plrlevel != 0) { spellColor = PAL16_RED - 59; } PrintSBookSpellType(out, spellListItem.location, _("Scroll"), spellColor); - InfoString = fmt::format(_("Scroll of {:s}"), pgettext("spell", spellDataItem.sNameText)); + InfoString = fmt::format(fmt::runtime(_("Scroll of {:s}")), pgettext("spell", spellDataItem.sNameText)); const InventoryAndBeltPlayerItemsRange items { myPlayer }; const int scrollCount = std::count_if(items.begin(), items.end(), [spellId](const Item &item) { return item.isScrollOf(spellId); }); - AddPanelString(fmt::format(ngettext("{:d} Scroll", "{:d} Scrolls", scrollCount), scrollCount)); + AddPanelString(fmt::format(fmt::runtime(ngettext("{:d} Scroll", "{:d} Scrolls", scrollCount)), scrollCount)); } break; case RSPLTYPE_CHARGES: { if (myPlayer.plrlevel != 0) { spellColor = PAL16_ORANGE + 5; } PrintSBookSpellType(out, spellListItem.location, _("Staff"), spellColor); - InfoString = fmt::format(_("Staff of {:s}"), pgettext("spell", spellDataItem.sNameText)); + InfoString = fmt::format(fmt::runtime(_("Staff of {:s}")), pgettext("spell", spellDataItem.sNameText)); int charges = myPlayer.InvBody[INVLOC_HAND_LEFT]._iCharges; - AddPanelString(fmt::format(ngettext("{:d} Charge", "{:d} Charges", charges), charges)); + AddPanelString(fmt::format(fmt::runtime(ngettext("{:d} Charge", "{:d} Charges", charges)), charges)); } break; case RSPLTYPE_INVALID: break; } if (hotkeyName) { - AddPanelString(fmt::format(_("Spell Hotkey {:s}"), *hotkeyName)); + AddPanelString(fmt::format(fmt::runtime(_("Spell Hotkey {:s}")), *hotkeyName)); } } } diff --git a/Source/player.cpp b/Source/player.cpp index 13b77053d..656206d4d 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -3102,7 +3102,7 @@ StartPlayerKill(int pnum, int earflag) if (earflag != 0) { Item ear; InitializeItem(ear, IDI_EAR); - CopyUtf8(ear._iName, fmt::format(_("Ear of {:s}"), player._pName), sizeof(ear._iName)); + CopyUtf8(ear._iName, fmt::format(fmt::runtime(_("Ear of {:s}")), player._pName), sizeof(ear._iName)); CopyUtf8(ear._iIName, player._pName, sizeof(ear._iIName)); switch (player._pClass) { case HeroClass::Sorcerer: diff --git a/Source/plrmsg.cpp b/Source/plrmsg.cpp index 3faaf3cb2..56a329487 100644 --- a/Source/plrmsg.cpp +++ b/Source/plrmsg.cpp @@ -80,7 +80,7 @@ void SendPlrMsg(Player &player, string_view text) { PlayerMessage &message = GetNextMessage(); - std::string from = fmt::format(_("{:s} (lvl {:d}): "), player._pName, player._pLevel); + std::string from = fmt::format(fmt::runtime(_("{:s} (lvl {:d}): ")), player._pName, player._pLevel); message.style = UiFlags::ColorWhite; message.time = SDL_GetTicks(); diff --git a/Source/qol/chatlog.cpp b/Source/qol/chatlog.cpp index 8d16ecc1f..a97c3f657 100644 --- a/Source/qol/chatlog.cpp +++ b/Source/qol/chatlog.cpp @@ -123,7 +123,7 @@ void AddMessageToChatLog(string_view message, Player *player, UiFlags flags) if (player == nullptr) { ChatLogLines.emplace_back(MultiColoredText { "{0} {1}", { { timestamp, UiFlags::ColorRed }, { std::string(message), flags } } }); } else { - std::string playerInfo = fmt::format(_("{:s} (lvl {:d}): "), player->_pName, player->_pLevel); + std::string playerInfo = fmt::format(fmt::runtime(_("{:s} (lvl {:d}): ")), player->_pName, player->_pLevel); ChatLogLines.emplace_back(MultiColoredText { std::string(message), { {} }, 20 }); UiFlags nameColor = player == MyPlayer ? UiFlags::ColorWhitegold : UiFlags::ColorBlue; ChatLogLines.emplace_back(MultiColoredText { "{0} - {1}", { { timestamp, UiFlags::ColorRed }, { playerInfo, nameColor } } }); @@ -152,7 +152,7 @@ void DrawChatLog(const Surface &out) const int sx = uiPosition.x + PaddingLeft; const int sy = uiPosition.y; - DrawString(out, fmt::format(_("Chat History (Messages: {:d})"), MessageCounter), + DrawString(out, fmt::format(fmt::runtime(_("Chat History (Messages: {:d})")), MessageCounter), { { sx, sy + PaddingTop + blankLineHeight }, { ContentTextWidth, lineHeight } }, (UnreadFlag ? UiFlags::ColorRed : UiFlags::ColorWhitegold) | UiFlags::AlignCenter); diff --git a/Source/qol/itemlabels.cpp b/Source/qol/itemlabels.cpp index e7ff4e354..b3bf2a648 100644 --- a/Source/qol/itemlabels.cpp +++ b/Source/qol/itemlabels.cpp @@ -70,7 +70,7 @@ void AddItemToLabelQueue(int id, int x, int y) std::string textOnGround; if (item._itype == ItemType::Gold) { - textOnGround = fmt::format(_("{:d} gold"), item._ivalue); + textOnGround = fmt::format(fmt::runtime(_("{:d} gold")), item._ivalue); } else { textOnGround = item._iIdentified ? item._iIName : item._iName; } diff --git a/Source/qol/xpbar.cpp b/Source/qol/xpbar.cpp index 6da77c837..03e4ebfe4 100644 --- a/Source/qol/xpbar.cpp +++ b/Source/qol/xpbar.cpp @@ -144,13 +144,13 @@ bool CheckXPBarInfo() const int8_t charLevel = player._pLevel; - AddPanelString(fmt::format(_("Level {:d}"), charLevel)); + AddPanelString(fmt::format(fmt::runtime(_("Level {:d}")), charLevel)); if (charLevel == MAXCHARLEVEL) { // Show a maximum level indicator for max level players. InfoColor = UiFlags::ColorWhitegold; - AddPanelString(fmt::format(_("Experience: {:s}"), PrintWithSeparator(ExpLvlsTbl[charLevel - 1]))); + AddPanelString(fmt::format(fmt::runtime(_("Experience: {:s}")), PrintWithSeparator(ExpLvlsTbl[charLevel - 1]))); AddPanelString(_("Maximum Level")); return true; @@ -158,9 +158,9 @@ bool CheckXPBarInfo() InfoColor = UiFlags::ColorWhite; - AddPanelString(fmt::format(_("Experience: {:s}"), PrintWithSeparator(player._pExperience))); - AddPanelString(fmt::format(_("Next Level: {:s}"), PrintWithSeparator(ExpLvlsTbl[charLevel]))); - AddPanelString(fmt::format(_("{:s} to Level {:d}"), PrintWithSeparator(ExpLvlsTbl[charLevel] - player._pExperience), charLevel + 1)); + AddPanelString(fmt::format(fmt::runtime(_("Experience: {:s}")), PrintWithSeparator(player._pExperience))); + AddPanelString(fmt::format(fmt::runtime(_("Next Level: {:s}")), PrintWithSeparator(ExpLvlsTbl[charLevel]))); + AddPanelString(fmt::format(fmt::runtime(_("{:s} to Level {:d}")), PrintWithSeparator(ExpLvlsTbl[charLevel] - player._pExperience), charLevel + 1)); return true; } diff --git a/Source/quests.cpp b/Source/quests.cpp index 864ada8d5..74a250d66 100644 --- a/Source/quests.cpp +++ b/Source/quests.cpp @@ -447,7 +447,7 @@ bool ForceQuests() int ql = quest._qslvl - 1; if (EntranceBoundaryContains(quest.position, cursPosition)) { - InfoString = fmt::format(_(/* TRANSLATORS: Used for Quest Portals. {:s} is a Map Name */ "To {:s}"), _(QuestTriggerNames[ql])); + InfoString = fmt::format(fmt::runtime(_(/* TRANSLATORS: Used for Quest Portals. {:s} is a Map Name */ "To {:s}")), _(QuestTriggerNames[ql])); cursPosition = quest.position; return true; } diff --git a/Source/stores.cpp b/Source/stores.cpp index 3baf495d5..467e5177a 100644 --- a/Source/stores.cpp +++ b/Source/stores.cpp @@ -258,7 +258,7 @@ void PrintStoreItem(const Item &item, int l, UiFlags flags) if (item._iMiscId == IMISC_STAFF && item._iMaxCharges != 0) { if (!productLine.empty()) AppendStrView(productLine, _(", ")); - productLine.append(fmt::format(_("Charges: {:d}/{:d}"), item._iCharges, item._iMaxCharges)); + productLine.append(fmt::format(fmt::runtime(_("Charges: {:d}/{:d}")), item._iCharges, item._iMaxCharges)); } if (!productLine.empty()) { AddSText(40, l, productLine, flags, false); @@ -268,11 +268,11 @@ void PrintStoreItem(const Item &item, int l, UiFlags flags) if (item._itype != ItemType::Misc) { if (item._iClass == ICLASS_WEAPON) - productLine = fmt::format(_("Damage: {:d}-{:d} "), item._iMinDam, item._iMaxDam); + productLine = fmt::format(fmt::runtime(_("Damage: {:d}-{:d} ")), item._iMinDam, item._iMaxDam); else if (item._iClass == ICLASS_ARMOR) - productLine = fmt::format(_("Armor: {:d} "), item._iAC); + productLine = fmt::format(fmt::runtime(_("Armor: {:d} ")), item._iAC); if (item._iMaxDur != DUR_INDESTRUCTIBLE && item._iMaxDur != 0) - productLine += fmt::format(_("Dur: {:d}/{:d}, "), item._iDurability, item._iMaxDur); + productLine += fmt::format(fmt::runtime(_("Dur: {:d}/{:d}, ")), item._iDurability, item._iMaxDur); else AppendStrView(productLine, _("Indestructible, ")); } @@ -286,11 +286,11 @@ void PrintStoreItem(const Item &item, int l, UiFlags flags) } else { AppendStrView(productLine, _("Required:")); if (str != 0) - productLine.append(fmt::format(_(" {:d} Str"), str)); + productLine.append(fmt::format(fmt::runtime(_(" {:d} Str")), str)); if (mag != 0) - productLine.append(fmt::format(_(" {:d} Mag"), mag)); + productLine.append(fmt::format(fmt::runtime(_(" {:d} Mag")), mag)); if (dex != 0) - productLine.append(fmt::format(_(" {:d} Dex"), dex)); + productLine.append(fmt::format(fmt::runtime(_(" {:d} Dex")), dex)); } AddSText(40, l++, productLine, flags, false); } @@ -1257,10 +1257,10 @@ void StartTalk() stextsize = false; stextscrl = false; - AddSText(0, 2, fmt::format(_("Talk to {:s}"), _(TownerNames[talker])), UiFlags::ColorWhitegold | UiFlags::AlignCenter, false); + AddSText(0, 2, fmt::format(fmt::runtime(_("Talk to {:s}")), _(TownerNames[talker])), UiFlags::ColorWhitegold | UiFlags::AlignCenter, false); AddSLine(5); if (gbIsSpawn) { - AddSText(0, 10, fmt::format(_("Talking to {:s}"), _(TownerNames[talker])), UiFlags::ColorWhite | UiFlags::AlignCenter, false); + AddSText(0, 10, fmt::format(fmt::runtime(_("Talking to {:s}")), _(TownerNames[talker])), UiFlags::ColorWhite | UiFlags::AlignCenter, false); AddSText(0, 12, _("is not available"), UiFlags::ColorWhite | UiFlags::AlignCenter, false); AddSText(0, 14, _("in the shareware"), UiFlags::ColorWhite | UiFlags::AlignCenter, false); AddSText(0, 16, _("version"), UiFlags::ColorWhite | UiFlags::AlignCenter, false); @@ -2437,7 +2437,7 @@ void DrawSText(const Surface &out) } if (RenderGold) { - PrintSString(out, 28, 1, fmt::format(_("Your gold: {:d}"), TotalPlayerGold()).c_str(), UiFlags::ColorWhitegold | UiFlags::AlignRight); + PrintSString(out, 28, 1, fmt::format(fmt::runtime(_("Your gold: {:d}")), TotalPlayerGold()).c_str(), UiFlags::ColorWhitegold | UiFlags::AlignRight); } if (stextscrl) diff --git a/Source/trigs.cpp b/Source/trigs.cpp index d87031df9..791dde5da 100644 --- a/Source/trigs.cpp +++ b/Source/trigs.cpp @@ -415,7 +415,7 @@ bool ForceL1Trig() for (int i = 0; L1UpList[i] != -1; i++) { if (dPiece[cursPosition.x][cursPosition.y] == L1UpList[i]) { if (currlevel > 1) - InfoString = fmt::format(_("Up to level {:d}"), currlevel - 1); + InfoString = fmt::format(fmt::runtime(_("Up to level {:d}")), currlevel - 1); else InfoString = _("Up to town"); for (int j = 0; j < numtrigs; j++) { @@ -428,7 +428,7 @@ bool ForceL1Trig() } for (int i = 0; L1DownList[i] != -1; i++) { if (dPiece[cursPosition.x][cursPosition.y] == L1DownList[i]) { - InfoString = fmt::format(_("Down to level {:d}"), currlevel + 1); + InfoString = fmt::format(fmt::runtime(_("Down to level {:d}")), currlevel + 1); for (int j = 0; j < numtrigs; j++) { if (trigs[j]._tmsg == WM_DIABNEXTLVL) { cursPosition = trigs[j].position; @@ -450,7 +450,7 @@ bool ForceL2Trig() int dx = abs(trigs[j].position.x - cursPosition.x); int dy = abs(trigs[j].position.y - cursPosition.y); if (dx < 4 && dy < 4) { - InfoString = fmt::format(_("Up to level {:d}"), currlevel - 1); + InfoString = fmt::format(fmt::runtime(_("Up to level {:d}")), currlevel - 1); cursPosition = trigs[j].position; return true; } @@ -461,7 +461,7 @@ bool ForceL2Trig() for (int i = 0; L2DownList[i] != -1; i++) { if (dPiece[cursPosition.x][cursPosition.y] == L2DownList[i]) { - InfoString = fmt::format(_("Down to level {:d}"), currlevel + 1); + InfoString = fmt::format(fmt::runtime(_("Down to level {:d}")), currlevel + 1); for (int j = 0; j < numtrigs; j++) { if (trigs[j]._tmsg == WM_DIABNEXTLVL) { cursPosition = trigs[j].position; @@ -496,7 +496,7 @@ bool ForceL3Trig() { for (int i = 0; L3UpList[i] != -1; ++i) { if (dPiece[cursPosition.x][cursPosition.y] == L3UpList[i]) { - InfoString = fmt::format(_("Up to level {:d}"), currlevel - 1); + InfoString = fmt::format(fmt::runtime(_("Up to level {:d}")), currlevel - 1); for (int j = 0; j < numtrigs; j++) { if (trigs[j]._tmsg == WM_DIABPREVLVL) { int dx = abs(trigs[j].position.x - cursPosition.x); @@ -513,7 +513,7 @@ bool ForceL3Trig() if (dPiece[cursPosition.x][cursPosition.y] == L3DownList[i] || dPiece[cursPosition.x + 1][cursPosition.y] == L3DownList[i] || dPiece[cursPosition.x + 2][cursPosition.y] == L3DownList[i]) { - InfoString = fmt::format(_("Down to level {:d}"), currlevel + 1); + InfoString = fmt::format(fmt::runtime(_("Down to level {:d}")), currlevel + 1); for (int j = 0; j < numtrigs; j++) { if (trigs[j]._tmsg == WM_DIABNEXTLVL) { cursPosition = trigs[j].position; @@ -548,7 +548,7 @@ bool ForceL4Trig() { for (int i = 0; L4UpList[i] != -1; ++i) { if (dPiece[cursPosition.x][cursPosition.y] == L4UpList[i]) { - InfoString = fmt::format(_("Up to level {:d}"), currlevel - 1); + InfoString = fmt::format(fmt::runtime(_("Up to level {:d}")), currlevel - 1); for (int j = 0; j < numtrigs; j++) { if (trigs[j]._tmsg == WM_DIABPREVLVL) { cursPosition = trigs[j].position; @@ -560,7 +560,7 @@ bool ForceL4Trig() for (int i = 0; L4DownList[i] != -1; i++) { if (dPiece[cursPosition.x][cursPosition.y] == L4DownList[i]) { - InfoString = fmt::format(_("Down to level {:d}"), currlevel + 1); + InfoString = fmt::format(fmt::runtime(_("Down to level {:d}")), currlevel + 1); for (int j = 0; j < numtrigs; j++) { if (trigs[j]._tmsg == WM_DIABNEXTLVL) { cursPosition = trigs[j].position; @@ -609,7 +609,7 @@ bool ForceHiveTrig() { for (int i = 0; L6UpList[i] != -1; ++i) { if (dPiece[cursPosition.x][cursPosition.y] == L6UpList[i]) { - InfoString = fmt::format(_("Up to Nest level {:d}"), currlevel - 17); + InfoString = fmt::format(fmt::runtime(_("Up to Nest level {:d}")), currlevel - 17); for (int j = 0; j < numtrigs; j++) { if (trigs[j]._tmsg == WM_DIABPREVLVL) { cursPosition = trigs[j].position; @@ -622,7 +622,7 @@ bool ForceHiveTrig() if (dPiece[cursPosition.x][cursPosition.y] == L6DownList[i] || dPiece[cursPosition.x + 1][cursPosition.y] == L6DownList[i] || dPiece[cursPosition.x + 2][cursPosition.y] == L6DownList[i]) { - InfoString = fmt::format(_("Down to level {:d}"), currlevel - 15); + InfoString = fmt::format(fmt::runtime(_("Down to level {:d}")), currlevel - 15); for (int j = 0; j < numtrigs; j++) { if (trigs[j]._tmsg == WM_DIABNEXTLVL) { cursPosition = trigs[j].position; @@ -657,7 +657,7 @@ bool ForceCryptTrig() { for (int i = 0; L5UpList[i] != -1; i++) { if (dPiece[cursPosition.x][cursPosition.y] == L5UpList[i]) { - InfoString = fmt::format(_("Up to Crypt level {:d}"), currlevel - 21); + InfoString = fmt::format(fmt::runtime(_("Up to Crypt level {:d}")), currlevel - 21); for (int j = 0; j < numtrigs; j++) { if (trigs[j]._tmsg == WM_DIABPREVLVL) { cursPosition = trigs[j].position; @@ -672,7 +672,7 @@ bool ForceCryptTrig() } for (int i = 0; L5DownList[i] != -1; i++) { if (dPiece[cursPosition.x][cursPosition.y] == L5DownList[i]) { - InfoString = fmt::format(_("Down to Crypt level {:d}"), currlevel - 19); + InfoString = fmt::format(fmt::runtime(_("Down to Crypt level {:d}")), currlevel - 19); for (int j = 0; j < numtrigs; j++) { if (trigs[j]._tmsg == WM_DIABNEXTLVL) { cursPosition = trigs[j].position; @@ -720,7 +720,7 @@ bool ForceSKingTrig() { for (int i = 0; L1UpList[i] != -1; i++) { if (dPiece[cursPosition.x][cursPosition.y] == L1UpList[i]) { - InfoString = fmt::format(_("Back to Level {:d}"), Quests[Q_SKELKING]._qlevel); + InfoString = fmt::format(fmt::runtime(_("Back to Level {:d}")), Quests[Q_SKELKING]._qlevel); cursPosition = trigs[0].position; return true; @@ -734,7 +734,7 @@ bool ForceSChambTrig() { for (int i = 0; L2DownList[i] != -1; i++) { if (dPiece[cursPosition.x][cursPosition.y] == L2DownList[i]) { - InfoString = fmt::format(_("Back to Level {:d}"), Quests[Q_SCHAMB]._qlevel); + InfoString = fmt::format(fmt::runtime(_("Back to Level {:d}")), Quests[Q_SCHAMB]._qlevel); cursPosition = trigs[0].position; return true; @@ -748,7 +748,7 @@ bool ForcePWaterTrig() { for (int i = 0; L3DownList[i] != -1; i++) { if (dPiece[cursPosition.x][cursPosition.y] == L3DownList[i]) { - InfoString = fmt::format(_("Back to Level {:d}"), Quests[Q_PWATER]._qlevel); + InfoString = fmt::format(fmt::runtime(_("Back to Level {:d}")), Quests[Q_PWATER]._qlevel); cursPosition = trigs[0].position; return true; diff --git a/Source/utils/log.hpp b/Source/utils/log.hpp index e741d51d1..08c7fc277 100644 --- a/Source/utils/log.hpp +++ b/Source/utils/log.hpp @@ -45,7 +45,7 @@ std::string format(string_view fmt, Args &&...args) { FMT_TRY { - return fmt::format(fmt, std::forward(args)...); + return fmt::format(fmt::runtime(fmt), std::forward(args)...); } FMT_CATCH(const fmt::format_error &e) {