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/frontend/StarCraftingInterface.cpp | |
parent | 14b9689b6d4f4ad5276c88130dc6e449bedc0709 (diff) |
The Formatting String Catastrophe
Diffstat (limited to 'source/frontend/StarCraftingInterface.cpp')
-rw-r--r-- | source/frontend/StarCraftingInterface.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/source/frontend/StarCraftingInterface.cpp b/source/frontend/StarCraftingInterface.cpp index 01f7e3c..f3cedf5 100644 --- a/source/frontend/StarCraftingInterface.cpp +++ b/source/frontend/StarCraftingInterface.cpp @@ -294,7 +294,7 @@ void CraftingPane::update() { updateCraftButtons(); } - setLabel("lblPlayerMoney", strf("%s", (int)m_player->currency("money"))); + setLabel("lblPlayerMoney", strf("{}", (int)m_player->currency("money"))); Pane::update(); } @@ -405,7 +405,7 @@ void CraftingPane::setupWidget(WidgetPtr const& widget, ItemRecipe const& recipe String name = item->friendlyName(); if (recipe.output.count() > 1) - name = strf("%s (x%s)", name, recipe.output.count()); + name = strf("{} (x{})", name, recipe.output.count()); auto itemName = widget->fetchChild<LabelWidget>("itemName"); auto notcraftableoverlay = widget->fetchChild<ImageWidget>("notcraftableoverlay"); @@ -421,7 +421,7 @@ void CraftingPane::setupWidget(WidgetPtr const& widget, ItemRecipe const& recipe } if (price > 0) { - widget->setLabel("priceLabel", strf("%s", price)); + widget->setLabel("priceLabel", strf("{}", price)); if (auto icon = widget->fetchChild<ImageWidget>("moneyIcon")) icon->setVisibility(true); } else { @@ -463,7 +463,7 @@ PanePtr CraftingPane::setupTooltip(ItemRecipe const& recipe) { auto widget = guiList->addItem(); widget->fetchChild<LabelWidget>("itemName")->setText(item->friendlyName()); auto countWidget = widget->fetchChild<LabelWidget>("count"); - countWidget->setText(strf("%s/%s", availableCount, requiredCount)); + countWidget->setText(strf("{}/{}", availableCount, requiredCount)); if (availableCount < requiredCount) countWidget->setColor(Color::Red); else @@ -616,7 +616,7 @@ void CraftingPane::countTextChanged() { void CraftingPane::countChanged() { if (m_textBox) - m_textBox->setText(strf("x%s", m_count), false); + m_textBox->setText(strf("x{}", m_count), false); } List<ItemRecipe> CraftingPane::determineRecipes() { |