Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/frontend
diff options
context:
space:
mode:
Diffstat (limited to 'source/frontend')
-rw-r--r--source/frontend/StarActionBar.cpp20
-rw-r--r--source/frontend/StarBookmarkInterface.cpp4
-rw-r--r--source/frontend/StarCharCreation.cpp12
-rw-r--r--source/frontend/StarChat.cpp6
-rw-r--r--source/frontend/StarCinematic.cpp2
-rw-r--r--source/frontend/StarClientCommandProcessor.cpp42
-rw-r--r--source/frontend/StarCodexInterface.cpp2
-rw-r--r--source/frontend/StarContainerInterface.cpp2
-rw-r--r--source/frontend/StarCraftingInterface.cpp10
-rw-r--r--source/frontend/StarGraphicsMenu.cpp4
-rw-r--r--source/frontend/StarInventory.cpp22
-rw-r--r--source/frontend/StarItemTooltip.cpp22
-rw-r--r--source/frontend/StarKeybindingsMenu.cpp2
-rw-r--r--source/frontend/StarMainInterface.cpp12
-rw-r--r--source/frontend/StarMerchantInterface.cpp10
-rw-r--r--source/frontend/StarQuestInterface.cpp4
-rw-r--r--source/frontend/StarRadioMessagePopup.cpp6
-rw-r--r--source/frontend/StarScriptPane.cpp2
-rw-r--r--source/frontend/StarTeamBar.cpp4
-rw-r--r--source/frontend/StarTeleportDialog.cpp2
-rw-r--r--source/frontend/StarWidgetLuaBindings.cpp2
21 files changed, 96 insertions, 96 deletions
diff --git a/source/frontend/StarActionBar.cpp b/source/frontend/StarActionBar.cpp
index 6c9b48c..5ccff7b 100644
--- a/source/frontend/StarActionBar.cpp
+++ b/source/frontend/StarActionBar.cpp
@@ -31,15 +31,15 @@ ActionBar::ActionBar(MainInterfacePaneManager* paneManager, PlayerPtr player) {
GuiReader reader;
for (uint8_t i = 0; i < m_player->inventory()->customBarIndexes(); ++i) {
- reader.registerCallback(strf("customBar%sL", i + 1), bind(&ActionBar::customBarClick, this, i, true));
- reader.registerCallback(strf("customBar%sR", i + 1), bind(&ActionBar::customBarClick, this, i, false));
+ reader.registerCallback(strf("customBar{}L", i + 1), bind(&ActionBar::customBarClick, this, i, true));
+ reader.registerCallback(strf("customBar{}R", i + 1), bind(&ActionBar::customBarClick, this, i, false));
- reader.registerCallback(strf("customBar%sL.right", i + 1), bind(&ActionBar::customBarClickRight, this, i, true));
- reader.registerCallback(strf("customBar%sR.right", i + 1), bind(&ActionBar::customBarClickRight, this, i, false));
+ reader.registerCallback(strf("customBar{}L.right", i + 1), bind(&ActionBar::customBarClickRight, this, i, true));
+ reader.registerCallback(strf("customBar{}R.right", i + 1), bind(&ActionBar::customBarClickRight, this, i, false));
}
for (uint8_t i = 0; i < EssentialItemCount; ++i)
- reader.registerCallback(strf("essentialBar%s", i + 1), bind(&ActionBar::essentialBarClick, this, i));
+ reader.registerCallback(strf("essentialBar{}", i + 1), bind(&ActionBar::essentialBarClick, this, i));
reader.registerCallback("pickupToActionBar", [=](Widget* widget) {
auto button = as<ButtonWidget>(widget);
@@ -53,10 +53,10 @@ ActionBar::ActionBar(MainInterfacePaneManager* paneManager, PlayerPtr player) {
reader.construct(m_config.get("paneLayout"), this);
for (uint8_t i = 0; i < m_player->inventory()->customBarIndexes(); ++i) {
- auto customBarLeft = fetchChild<ItemSlotWidget>(strf("customBar%sL", i + 1));
- auto customBarRight = fetchChild<ItemSlotWidget>(strf("customBar%sR", i + 1));
- auto customBarLeftOverlay = fetchChild<ImageWidget>(strf("customBar%sLOverlay", i + 1));
- auto customBarRightOverlay = fetchChild<ImageWidget>(strf("customBar%sROverlay", i + 1));
+ auto customBarLeft = fetchChild<ItemSlotWidget>(strf("customBar{}L", i + 1));
+ auto customBarRight = fetchChild<ItemSlotWidget>(strf("customBar{}R", i + 1));
+ auto customBarLeftOverlay = fetchChild<ImageWidget>(strf("customBar{}LOverlay", i + 1));
+ auto customBarRightOverlay = fetchChild<ImageWidget>(strf("customBar{}ROverlay", i + 1));
TextPositioning countPosition = {jsonToVec2F(m_config.get("countMidAnchor")), HorizontalAnchor::HMidAnchor};
customBarLeft->setCountPosition(countPosition);
@@ -69,7 +69,7 @@ ActionBar::ActionBar(MainInterfacePaneManager* paneManager, PlayerPtr player) {
m_customSelectedWidget = fetchChild<ImageWidget>("customSelect");
for (uint8_t i = 0; i < EssentialItemCount; ++i)
- m_essentialBarWidgets.append(fetchChild<ItemSlotWidget>(strf("essentialBar%s", i + 1)));
+ m_essentialBarWidgets.append(fetchChild<ItemSlotWidget>(strf("essentialBar{}", i + 1)));
m_essentialSelectedWidget = fetchChild<ImageWidget>("essentialSelect");
}
diff --git a/source/frontend/StarBookmarkInterface.cpp b/source/frontend/StarBookmarkInterface.cpp
index 132ac13..d11ac33 100644
--- a/source/frontend/StarBookmarkInterface.cpp
+++ b/source/frontend/StarBookmarkInterface.cpp
@@ -46,7 +46,7 @@ void EditBookmarkDialog::show() {
}
auto assets = Root::singleton().assets();
- fetchChild<ImageWidget>("imgIcon")->setImage(strf("/interface/bookmarks/icons/%s.png", m_bookmark.icon));
+ fetchChild<ImageWidget>("imgIcon")->setImage(strf("/interface/bookmarks/icons/{}.png", m_bookmark.icon));
fetchChild<LabelWidget>("lblPlanetName")->setText(m_bookmark.targetName);
fetchChild<TextBoxWidget>("name")->setText(m_bookmark.bookmarkName, false);
@@ -75,7 +75,7 @@ void EditBookmarkDialog::close() {
void setupBookmarkEntry(WidgetPtr const& entry, TeleportBookmark const& bookmark) {
entry->fetchChild<LabelWidget>("name")->setText(bookmark.bookmarkName);
entry->fetchChild<LabelWidget>("planetName")->setText(bookmark.targetName);
- entry->fetchChild<ImageWidget>("icon")->setImage(strf("/interface/bookmarks/icons/%s.png", bookmark.icon));
+ entry->fetchChild<ImageWidget>("icon")->setImage(strf("/interface/bookmarks/icons/{}.png", bookmark.icon));
}
}
diff --git a/source/frontend/StarCharCreation.cpp b/source/frontend/StarCharCreation.cpp
index fd617df..c1e0f1d 100644
--- a/source/frontend/StarCharCreation.cpp
+++ b/source/frontend/StarCharCreation.cpp
@@ -165,7 +165,7 @@ void CharCreationPane::createPlayer() {
throw CharCreationException("The charPreview portrait has the wrong type.");
}
} catch (CharCreationException const& e) {
- Logger::error("Character Preview portrait was not found in the json specification. %s", outputException(e, false));
+ Logger::error("Character Preview portrait was not found in the json specification. {}", outputException(e, false));
}
}
@@ -269,15 +269,15 @@ void CharCreationPane::changed() {
fetchChild<LabelWidget>("labelPortrait")->setText(labels[8]);
fetchChild<LabelWidget>("labelPersonality")->setText(labels[9]);
- fetchChild<ButtonWidget>(strf("species.%s", m_speciesChoice))->check();
- fetchChild<ButtonWidget>(strf("gender.%s", genderIdx))->check();
- auto modeButton = fetchChild<ButtonWidget>(strf("mode.%s", m_modeChoice));
+ fetchChild<ButtonWidget>(strf("species.{}", m_speciesChoice))->check();
+ fetchChild<ButtonWidget>(strf("gender.{}", genderIdx))->check();
+ auto modeButton = fetchChild<ButtonWidget>(strf("mode.{}", m_modeChoice));
modeButton->check();
setLabel("labelMode", modeButton->data().getString("description", "fail"));
// Update the gender images for the new species
for (size_t i = 0; i < species.genderOptions.size(); i++)
- fetchChild<ButtonWidget>(strf("gender.%s", i))->setOverlayImage(species.genderOptions[i].image);
+ fetchChild<ButtonWidget>(strf("gender.{}", i))->setOverlayImage(species.genderOptions[i].image);
for (auto const& nameDefPair : root.speciesDatabase()->allSpecies()) {
String name;
@@ -286,7 +286,7 @@ void CharCreationPane::changed() {
// NOTE: Probably not hot enough to matter, but this contains and indexOf makes this loop
// O(n^2). This is less than ideal.
if (m_speciesList.contains(name)) {
- auto bw = fetchChild<ButtonWidget>(strf("species.%s", m_speciesList.indexOf(name)));
+ auto bw = fetchChild<ButtonWidget>(strf("species.{}", m_speciesList.indexOf(name)));
if (bw)
bw->setOverlayImage(def->options().genderOptions[genderIdx].characterImage);
}
diff --git a/source/frontend/StarChat.cpp b/source/frontend/StarChat.cpp
index 4af8930..7b75f2d 100644
--- a/source/frontend/StarChat.cpp
+++ b/source/frontend/StarChat.cpp
@@ -183,7 +183,7 @@ void Chat::addMessages(List<ChatReceivedMessage> const& messages, bool showPane)
guiContext.setFontSize(m_fontSize);
StringList lines;
if (message.fromNick != "" && message.portrait == "")
- lines = guiContext.wrapInterfaceText(strf("<%s> %s", message.fromNick, message.text), wrapWidth);
+ lines = guiContext.wrapInterfaceText(strf("<{}> {}", message.fromNick, message.text), wrapWidth);
else
lines = guiContext.wrapInterfaceText(message.text, wrapWidth);
@@ -196,9 +196,9 @@ void Chat::addMessages(List<ChatReceivedMessage> const& messages, bool showPane)
}
if (message.fromNick != "")
- Logger::info("Chat: <%s> %s", message.fromNick, message.text);
+ Logger::info("Chat: <{}> {}", message.fromNick, message.text);
else
- Logger::info("Chat: %s", message.text);
+ Logger::info("Chat: {}", message.text);
}
if (showPane) {
diff --git a/source/frontend/StarCinematic.cpp b/source/frontend/StarCinematic.cpp
index a7a13ee..7408264 100644
--- a/source/frontend/StarCinematic.cpp
+++ b/source/frontend/StarCinematic.cpp
@@ -189,7 +189,7 @@ void Cinematic::render() {
m_completable = true;
if (!values.alpha)
continue;
- auto frame = strf("%s", ((int)values.frame) % panel->animationFrames);
+ auto frame = strf("{}", ((int)values.frame) % panel->animationFrames);
auto alphaColor = Color::rgbaf(1.0f, 1.0f, 1.0f, values.alpha);
for (auto const& d : panel->drawables) {
Drawable drawable = Drawable(d.set("image", d.getString("image").replaceTags(StringMap<String>{{"species", playerSpecies}, {"frame", frame}})));
diff --git a/source/frontend/StarClientCommandProcessor.cpp b/source/frontend/StarClientCommandProcessor.cpp
index bf9a434..f006d8e 100644
--- a/source/frontend/StarClientCommandProcessor.cpp
+++ b/source/frontend/StarClientCommandProcessor.cpp
@@ -92,11 +92,11 @@ StringList ClientCommandProcessor::handleCommand(String const& commandLine) {
}
return result;
} catch (ShellParsingException const& e) {
- Logger::error("Shell parsing exception: %s", outputException(e, false));
+ Logger::error("Shell parsing exception: {}", outputException(e, false));
return {"Shell parsing exception"};
} catch (std::exception const& e) {
- Logger::error("Exception caught handling client command %s: %s", commandLine, outputException(e, true));
- return {strf("Exception caught handling client command %s", commandLine)};
+ Logger::error("Exception caught handling client command {}: {}", commandLine, outputException(e, true));
+ return {strf("Exception caught handling client command {}", commandLine)};
}
}
@@ -114,7 +114,7 @@ String ClientCommandProcessor::reload() {
}
String ClientCommandProcessor::whoami() {
- return strf("Client: You are %s. You are %san Admin.",
+ return strf("Client: You are {}. You are {}an Admin.",
m_universeClient->mainPlayer()->name(), m_universeClient->mainPlayer()->isAdmin() ? "" : "not ");
}
@@ -122,7 +122,7 @@ String ClientCommandProcessor::gravity() {
if (!adminCommandAllowed())
return "You must be an admin to use this command.";
- return strf("%s", m_universeClient->worldClient()->gravity(m_universeClient->mainPlayer()->position()));
+ return strf("{}", m_universeClient->worldClient()->gravity(m_universeClient->mainPlayer()->position()));
}
String ClientCommandProcessor::debug() {
@@ -130,14 +130,14 @@ String ClientCommandProcessor::debug() {
return "You must be an admin to use this command.";
m_debugDisplayEnabled = !m_debugDisplayEnabled;
- return strf("Debug display %s", m_debugDisplayEnabled ? "enabled" : "disabled");
+ return strf("Debug display {}", m_debugDisplayEnabled ? "enabled" : "disabled");
}
String ClientCommandProcessor::boxes() {
if (!adminCommandAllowed())
return "You must be an admin to use this command.";
- return strf("Geometry debug display %s",
+ return strf("Geometry debug display {}",
m_universeClient->worldClient()->toggleCollisionDebug()
? "enabled" : "disabled");
}
@@ -146,7 +146,7 @@ String ClientCommandProcessor::fullbright() {
if (!adminCommandAllowed())
return "You must be an admin to use this command.";
- return strf("Fullbright render lighting %s",
+ return strf("Fullbright render lighting {}",
m_universeClient->worldClient()->toggleFullbright()
? "enabled" : "disabled");
}
@@ -156,7 +156,7 @@ String ClientCommandProcessor::setGravity(StringList const& arguments) {
return "You must be an admin to use this command.";
m_universeClient->worldClient()->overrideGravity(lexicalCast<float>(arguments.at(0)));
- return strf("Gravity set to %s, the change is LOCAL ONLY", arguments.at(0));
+ return strf("Gravity set to {}, the change is LOCAL ONLY", arguments.at(0));
}
String ClientCommandProcessor::resetGravity() {
@@ -172,13 +172,13 @@ String ClientCommandProcessor::fixedCamera() {
return "You must be an admin to use this command.";
m_fixedCameraEnabled = !m_fixedCameraEnabled;
- return strf("Fixed camera %s", m_fixedCameraEnabled ? "enabled" : "disabled");
+ return strf("Fixed camera {}", m_fixedCameraEnabled ? "enabled" : "disabled");
}
String ClientCommandProcessor::monochromeLighting() {
bool monochrome = !Root::singleton().configuration()->get("monochromeLighting").toBool();
Root::singleton().configuration()->set("monochromeLighting", monochrome);
- return strf("Monochrome lighting %s", monochrome ? "enabled" : "disabled");
+ return strf("Monochrome lighting {}", monochrome ? "enabled" : "disabled");
}
String ClientCommandProcessor::radioMessage(StringList const& arguments) {
@@ -222,7 +222,7 @@ String ClientCommandProcessor::completeQuest(StringList const& arguments) {
return "You must be an admin to use this command.";
m_universeClient->questManager()->getQuest(arguments.at(0))->complete();
- return strf("Quest %s complete", arguments.at(0));
+ return strf("Quest {} complete", arguments.at(0));
}
String ClientCommandProcessor::failQuest(StringList const& arguments) {
@@ -230,7 +230,7 @@ String ClientCommandProcessor::failQuest(StringList const& arguments) {
return "You must be an admin to use this command.";
m_universeClient->questManager()->getQuest(arguments.at(0))->fail();
- return strf("Quest %s failed", arguments.at(0));
+ return strf("Quest {} failed", arguments.at(0));
}
String ClientCommandProcessor::previewNewQuest(StringList const& arguments) {
@@ -269,12 +269,12 @@ String ClientCommandProcessor::clearScannedObjects() {
}
String ClientCommandProcessor::playTime() {
- return strf("Total play time: %s", Time::printDuration(m_universeClient->mainPlayer()->log()->playTime()));
+ return strf("Total play time: {}", Time::printDuration(m_universeClient->mainPlayer()->log()->playTime()));
}
String ClientCommandProcessor::deathCount() {
auto deaths = m_universeClient->mainPlayer()->log()->deathCount();
- return strf("Total deaths: %s%s", deaths, deaths == 0 ? ". Well done!" : "");
+ return strf("Total deaths: {}{}", deaths, deaths == 0 ? ". Well done!" : "");
}
String ClientCommandProcessor::cinema(StringList const& arguments) {
@@ -284,7 +284,7 @@ String ClientCommandProcessor::cinema(StringList const& arguments) {
m_cinematicOverlay->load(Root::singleton().assets()->json(arguments.at(0)));
if (arguments.size() > 1)
m_cinematicOverlay->setTime(lexicalCast<float>(arguments.at(1)));
- return strf("Started cinematic %s at %s", arguments.at(0), arguments.size() > 1 ? arguments.at(1) : "beginning");
+ return strf("Started cinematic {} at {}", arguments.at(0), arguments.size() > 1 ? arguments.at(1) : "beginning");
}
String ClientCommandProcessor::suicide() {
@@ -315,7 +315,7 @@ String ClientCommandProcessor::statistic(StringList const& arguments) {
StringList values;
for (String const& statName : arguments) {
- values.append(strf("%s = %s", statName, m_universeClient->statistics()->stat(statName)));
+ values.append(strf("{} = {}", statName, m_universeClient->statistics()->stat(statName)));
}
return values.join("\n");
}
@@ -331,9 +331,9 @@ String ClientCommandProcessor::giveEssentialItem(StringList const& arguments) {
auto item = Root::singleton().itemDatabase()->item(ItemDescriptor(arguments.at(0)));
auto slot = EssentialItemNames.getLeft(arguments.at(1));
m_universeClient->mainPlayer()->inventory()->setEssentialItem(slot, item);
- return strf("Put %s in player slot %s", item->name(), arguments.at(1));
+ return strf("Put {} in player slot {}", item->name(), arguments.at(1));
} catch (MapException const& e) {
- return strf("Invalid essential item slot %s.", arguments.at(1));
+ return strf("Invalid essential item slot {}.", arguments.at(1));
}
}
@@ -345,7 +345,7 @@ String ClientCommandProcessor::makeTechAvailable(StringList const& arguments) {
return "Not enouch arguments to /maketechavailable";
m_universeClient->mainPlayer()->techs()->makeAvailable(arguments.at(0));
- return strf("Added %s to player's visible techs", arguments.at(0));
+ return strf("Added {} to player's visible techs", arguments.at(0));
}
String ClientCommandProcessor::enableTech(StringList const& arguments) {
@@ -357,7 +357,7 @@ String ClientCommandProcessor::enableTech(StringList const& arguments) {
m_universeClient->mainPlayer()->techs()->makeAvailable(arguments.at(0));
m_universeClient->mainPlayer()->techs()->enable(arguments.at(0));
- return strf("Player tech %s enabled", arguments.at(0));
+ return strf("Player tech {} enabled", arguments.at(0));
}
String ClientCommandProcessor::upgradeShip(StringList const& arguments) {
diff --git a/source/frontend/StarCodexInterface.cpp b/source/frontend/StarCodexInterface.cpp
index f841c5d..aca0930 100644
--- a/source/frontend/StarCodexInterface.cpp
+++ b/source/frontend/StarCodexInterface.cpp
@@ -126,7 +126,7 @@ void CodexInterface::setupPageText() {
if (m_currentCodex) {
m_pageContent->setText(m_currentCodex->page(m_currentPage));
m_pageLabelWidget->show();
- m_pageNumberWidget->setText(strf("%d of %d", m_currentPage + 1, m_currentCodex->pageCount()));
+ m_pageNumberWidget->setText(strf("{} of {}", m_currentPage + 1, m_currentCodex->pageCount()));
m_titleLabel->setText(m_currentCodex->title());
m_nextPageButton->setEnabled(m_currentPage < m_currentCodex->pageCount() - 1);
m_prevPageButton->setEnabled(m_currentPage > 0);
diff --git a/source/frontend/StarContainerInterface.cpp b/source/frontend/StarContainerInterface.cpp
index e94c25c..9f80a94 100644
--- a/source/frontend/StarContainerInterface.cpp
+++ b/source/frontend/StarContainerInterface.cpp
@@ -129,7 +129,7 @@ ContainerPane::ContainerPane(WorldClientPtr worldClient, PlayerPtr player, Conta
m_reader.construct(guiConfig.get("gui"), this);
if (auto countWidget = fetchChild<LabelWidget>("count"))
- countWidget->setText(countWidget->text().replace("<slots>", strf("%s", container->containerSize())));
+ countWidget->setText(countWidget->text().replace("<slots>", strf("{}", container->containerSize())));
m_itemBag = make_shared<ItemBag>(container->containerSize());
auto items = container->containerItems();
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() {
diff --git a/source/frontend/StarGraphicsMenu.cpp b/source/frontend/StarGraphicsMenu.cpp
index 80aba55..3f0778c 100644
--- a/source/frontend/StarGraphicsMenu.cpp
+++ b/source/frontend/StarGraphicsMenu.cpp
@@ -148,7 +148,7 @@ void GraphicsMenu::syncGui() {
} else {
resSlider->setVal(m_resList.size() - 1);
}
- fetchChild<LabelWidget>("resValueLabel")->setText(strf("%dx%d", res[0], res[1]));
+ fetchChild<LabelWidget>("resValueLabel")->setText(strf("{}x{}", res[0], res[1]));
auto zoomSlider = fetchChild<SliderBarWidget>("zoomSlider");
auto zoomIt = std::lower_bound(m_zoomList.begin(), m_zoomList.end(), m_localChanges.get("zoomLevel").toFloat());
@@ -159,7 +159,7 @@ void GraphicsMenu::syncGui() {
} else {
zoomSlider->setVal(m_zoomList.size() - 1);
}
- fetchChild<LabelWidget>("zoomValueLabel")->setText(strf("%dx", m_localChanges.get("zoomLevel").toInt()));
+ fetchChild<LabelWidget>("zoomValueLabel")->setText(strf("{}x", m_localChanges.get("zoomLevel").toInt()));
fetchChild<ButtonWidget>("speechBubbleCheckbox")->setChecked(m_localChanges.get("speechBubbles").toBool());
diff --git a/source/frontend/StarInventory.cpp b/source/frontend/StarInventory.cpp
index 72d91e6..e54f288 100644
--- a/source/frontend/StarInventory.cpp
+++ b/source/frontend/StarInventory.cpp
@@ -87,7 +87,7 @@ InventoryPane::InventoryPane(MainInterface* parent, PlayerPtr player, ContainerI
for (auto name : bagOrder) {
auto itemGrid = itemBagConfig.get(name).getString("itemGrid");
invWindowReader.registerCallback(itemGrid, bind(leftClickCallback, name, _1));
- invWindowReader.registerCallback(strf("%s.right", itemGrid), bind(bagGridCallback, name, _1));
+ invWindowReader.registerCallback(strf("{}.right", itemGrid), bind(bagGridCallback, name, _1));
}
invWindowReader.registerCallback("close", [=](Widget*) {
@@ -195,7 +195,7 @@ PanePtr InventoryPane::createTooltip(Vec2I const& screenPosition) {
auto techDatabase = Root::singleton().techDatabase();
for (auto const& p : TechTypeNames) {
- if (auto techIcon = fetchChild<ImageWidget>(strf("tech%s", p.second))) {
+ if (auto techIcon = fetchChild<ImageWidget>(strf("tech{}", p.second))) {
if (techIcon->screenBoundRect().contains(screenPosition)) {
if (auto techModule = m_player->techs()->equippedTechs().maybe(p.first))
return SimpleTooltipBuilder::buildTooltip(techDatabase->tech(*techModule).description);
@@ -277,7 +277,7 @@ void InventoryPane::update() {
auto techDatabase = Root::singleton().techDatabase();
for (auto const& p : TechTypeNames) {
- if (auto techIcon = fetchChild<ImageWidget>(strf("tech%s", p.second))) {
+ if (auto techIcon = fetchChild<ImageWidget>(strf("tech{}", p.second))) {
if (auto techModule = m_player->techs()->equippedTechs().maybe(p.first))
techIcon->setImage(techDatabase->tech(*techModule).icon);
else
@@ -315,25 +315,25 @@ void InventoryPane::update() {
techOverlay->setVisibility(m_player->techOverridden());
auto healthLabel = fetchChild<LabelWidget>("healthtext");
- healthLabel->setText(strf("%d", m_player->maxHealth()));
+ healthLabel->setText(strf("{}", m_player->maxHealth()));
auto energyLabel = fetchChild<LabelWidget>("energytext");
- energyLabel->setText(strf("%d", m_player->maxEnergy()));
+ energyLabel->setText(strf("{}", m_player->maxEnergy()));
auto weaponLabel = fetchChild<LabelWidget>("weapontext");
- weaponLabel->setText(strf("%d%%", ceil(m_player->powerMultiplier() * 100)));
+ weaponLabel->setText(strf("{}%", ceil(m_player->powerMultiplier() * 100)));
auto defenseLabel = fetchChild<LabelWidget>("defensetext");
if (m_player->protection() == 0)
defenseLabel->setText("--");
else
- defenseLabel->setText(strf("%d", ceil(m_player->protection())));
+ defenseLabel->setText(strf("{}", ceil(m_player->protection())));
auto moneyLabel = fetchChild<LabelWidget>("lblMoney");
- moneyLabel->setText(strf("%d", m_player->currency("money")));
+ moneyLabel->setText(strf("{}", m_player->currency("money")));
if (m_player->currency("essence") > 0) {
fetchChild<ImageWidget>("imgEssenceIcon")->show();
auto essenceLabel = fetchChild<LabelWidget>("lblEssence");
essenceLabel->show();
- essenceLabel->setText(strf("%d", m_player->currency("essence")));
+ essenceLabel->setText(strf("{}", m_player->currency("essence")));
} else {
fetchChild<ImageWidget>("imgEssenceIcon")->hide();
fetchChild<LabelWidget>("lblEssence")->hide();
@@ -357,14 +357,14 @@ void InventoryPane::update() {
auto attackLabel = fetchChild<LabelWidget>("companionAttackStat");
if (auto attack = pet->stat("attack")) {
- attackLabel->setText(strf("%.0f", *attack));
+ attackLabel->setText(strf("{:.0f}", *attack));
} else {
attackLabel->setText("");
}
auto defenseLabel = fetchChild<LabelWidget>("companionDefenseStat");
if (auto defense = pet->stat("defense")) {
- defenseLabel->setText(strf("%.0f", *defense));
+ defenseLabel->setText(strf("{:.0f}", *defense));
} else {
defenseLabel->setText("");
}
diff --git a/source/frontend/StarItemTooltip.cpp b/source/frontend/StarItemTooltip.cpp
index 9138349..46a2d85 100644
--- a/source/frontend/StarItemTooltip.cpp
+++ b/source/frontend/StarItemTooltip.cpp
@@ -81,7 +81,7 @@ void ItemTooltipBuilder::buildItemDescriptionInner(
container->fetchChild<ItemSlotWidget>("icon")->setItem(item);
container->setLabel("nameLabel", item->name());
- container->setLabel("countLabel", strf("%s", item->count()));
+ container->setLabel("countLabel", strf("{}", item->count()));
container->setLabel("rarityLabel", RarityNames.getRight(item->rarity()).titleCase());
@@ -90,8 +90,8 @@ void ItemTooltipBuilder::buildItemDescriptionInner(
else
container->setLabel("handednessLabel", "1-Handed");
- container->setLabel("countLabel", strf("%s", item->instanceValue("fuelAmount", 0).toUInt() * item->count()));
- container->setLabel("priceLabel", strf("%s", (int)item->price()));
+ container->setLabel("countLabel", strf("{}", item->instanceValue("fuelAmount", 0).toUInt() * item->count()));
+ container->setLabel("priceLabel", strf("{}", (int)item->price()));
if (auto objectItem = as<ObjectItem>(item)) {
try {
@@ -103,13 +103,13 @@ void ItemTooltipBuilder::buildItemDescriptionInner(
}
if (objectItem->tooltipKind() == "container")
- container->setLabel("slotCountLabel", strf("Holds %s Items", objectItem->instanceValue("slotCount")));
+ container->setLabel("slotCountLabel", strf("Holds {} Items", objectItem->instanceValue("slotCount")));
title = object->shortDescription();
subTitle = categoryDisplayName(object->category());
description = object->description();
} catch (StarException const& e) {
- Logger::error("Failed to instantiate object for object item tooltip. %s", outputException(e, false));
+ Logger::error("Failed to instantiate object for object item tooltip. {}", outputException(e, false));
}
} else {
if (container->containsChild("objectImage")) {
@@ -137,9 +137,9 @@ void ItemTooltipBuilder::buildItemDescriptionInner(
}
if (auto fireable = as<FireableItem>(item)) {
- container->setLabel("cooldownTimeLabel", strf("%.2f", fireable->cooldownTime()));
- container->setLabel("windupTimeLabel", strf("%.2f", fireable->windupTime()));
- container->setLabel("speedLabel", strf("%.2f", 1.0f / (fireable->cooldownTime() + fireable->windupTime())));
+ container->setLabel("cooldownTimeLabel", strf("{:.2f}", fireable->cooldownTime()));
+ container->setLabel("windupTimeLabel", strf("{:.2f}", fireable->windupTime()));
+ container->setLabel("speedLabel", strf("{:.2f}", 1.0f / (fireable->cooldownTime() + fireable->windupTime())));
}
if (container->containsChild("largeImage")) {
@@ -198,21 +198,21 @@ void ItemTooltipBuilder::describePersistentEffect(
auto listItem = container->addItem();
listItem->fetchChild<ImageWidget>("statusImage")
->setImage(statsConfig.get(baseMultiplier->statName).getString("icon"));
- listItem->setLabel("statusLabel", strf("%s%%", (baseMultiplier->baseMultiplier - 1) * 100));
+ listItem->setLabel("statusLabel", strf("{}%", (baseMultiplier->baseMultiplier - 1) * 100));
}
} else if (auto valueModifier = modifierEffect->ptr<StatValueModifier>()) {
if (statsConfig.contains(valueModifier->statName)) {
auto listItem = container->addItem();
listItem->fetchChild<ImageWidget>("statusImage")
->setImage(statsConfig.get(valueModifier->statName).getString("icon"));
- listItem->setLabel("statusLabel", strf("%s%s", valueModifier->value < 0 ? "-" : "", valueModifier->value));
+ listItem->setLabel("statusLabel", strf("{}{}", valueModifier->value < 0 ? "-" : "", valueModifier->value));
}
} else if (auto effectiveMultiplier = modifierEffect->ptr<StatEffectiveMultiplier>()) {
if (statsConfig.contains(effectiveMultiplier->statName)) {
auto listItem = container->addItem();
listItem->fetchChild<ImageWidget>("statusImage")
->setImage(statsConfig.get(effectiveMultiplier->statName).getString("icon"));
- listItem->setLabel("statusLabel", strf("%s%%", (effectiveMultiplier->effectiveMultiplier - 1) * 100));
+ listItem->setLabel("statusLabel", strf("{}%", (effectiveMultiplier->effectiveMultiplier - 1) * 100));
}
}
}
diff --git a/source/frontend/StarKeybindingsMenu.cpp b/source/frontend/StarKeybindingsMenu.cpp
index 85b5b56..c07dae8 100644
--- a/source/frontend/StarKeybindingsMenu.cpp
+++ b/source/frontend/StarKeybindingsMenu.cpp
@@ -128,7 +128,7 @@ void KeybindingsMenu::buildListsFromConfig() {
for (auto const& bindingEntry : bindings.get(actionString).iterateArray())
inputDesc.append(inputDescriptorFromJson(bindingEntry));
} catch (StarException const& e) {
- Logger::warn("Could not load keybinding for %s. %s\n", actionString, e.what());
+ Logger::warn("Could not load keybinding for {}. {}\n", actionString, e.what());
}
m_childToAction.insert({newListMember->fetchChild<ButtonWidget>("boundKeys").get(), action});
diff --git a/source/frontend/StarMainInterface.cpp b/source/frontend/StarMainInterface.cpp
index 8a3d18b..9d3c3a5 100644
--- a/source/frontend/StarMainInterface.cpp
+++ b/source/frontend/StarMainInterface.cpp
@@ -681,7 +681,7 @@ void MainInterface::update() {
}
m_messageOverflow++;
- m_overflowMessage->message = m_config->overflowMessageText.replace("<count>", strf("%s", m_messageOverflow));
+ m_overflowMessage->message = m_config->overflowMessageText.replace("<count>", strf("{}", m_messageOverflow));
m_overflowMessage->cooldown = m_config->messageTime;
if (auto oldest = m_messages.sorted([](GuiMessagePtr a, GuiMessagePtr b) { return a->cooldown < b->cooldown; }).maybeFirst())
m_overflowMessage->cooldown = oldest.value()->cooldown;
@@ -862,11 +862,11 @@ void MainInterface::queueItemPickupText(ItemPtr const& item) {
auto countMessPair = m_itemDropMessages.get(descriptor.singular());
auto newCount = item->count() + countMessPair.first;
auto message = countMessPair.second;
- message->message = strf("%s - %s", item->friendlyName(), newCount);
+ message->message = strf("{} - {}", item->friendlyName(), newCount);
message->cooldown = m_config->messageTime;
m_itemDropMessages[descriptor.singular()] = {newCount, message};
} else {
- auto message = make_shared<GuiMessage>(strf("%s - %s", item->friendlyName(), item->count()), m_config->messageTime);
+ auto message = make_shared<GuiMessage>(strf("{} - {}", item->friendlyName(), item->count()), m_config->messageTime);
m_messages.append(message);
m_itemDropMessages[descriptor.singular()] = {item->count(), message};
}
@@ -929,7 +929,7 @@ PanePtr MainInterface::createEscapeDialog() {
});
escapeDialogReader.construct(assets->json("/interface.config:escapeDialog"), escapeDialogPtr);
- escapeDialog->fetchChild<LabelWidget>("lblversion")->setText(strf("Starbound - %s (%s)", StarVersionString, StarArchitectureString));
+ escapeDialog->fetchChild<LabelWidget>("lblversion")->setText(strf("Starbound - {} ({})", StarVersionString, StarArchitectureString));
return escapeDialog;
}
@@ -1268,7 +1268,7 @@ void MainInterface::renderDebug() {
int counter = 0;
for (auto const& pair : logMapValues) {
TextPositioning positioning = {Vec2F(m_config->debugOffset[0], windowHeight() - m_config->debugOffset[1] - m_config->fontSize * interfaceScale() * counter)};
- m_debugTextRect.combine(m_guiContext->determineTextSize(strf("%s: %s", pair.first, pair.second), positioning).padded(m_config->debugBackgroundPad));
+ m_debugTextRect.combine(m_guiContext->determineTextSize(strf("{}: {}", pair.first, pair.second), positioning).padded(m_config->debugBackgroundPad));
++counter;
}
@@ -1281,7 +1281,7 @@ void MainInterface::renderDebug() {
counter = 0;
for (auto const& pair : logMapValues) {
TextPositioning positioning = {Vec2F(m_config->debugOffset[0], windowHeight() - m_config->debugOffset[1] - m_config->fontSize * interfaceScale() * counter)};
- m_guiContext->renderText(strf("%s: %s", pair.first, pair.second), positioning);
+ m_guiContext->renderText(strf("{}: {}", pair.first, pair.second), positioning);
++counter;
}
m_guiContext->setFontColor(Vec4B::filled(255));
diff --git a/source/frontend/StarMerchantInterface.cpp b/source/frontend/StarMerchantInterface.cpp
index 7059cb8..4db2771 100644
--- a/source/frontend/StarMerchantInterface.cpp
+++ b/source/frontend/StarMerchantInterface.cpp
@@ -236,13 +236,13 @@ void MerchantPane::setupWidget(WidgetPtr const& widget, Json const& itemConfig)
String name = item->friendlyName();
if (item->count() > 1)
- name = strf("%s (x%s)", name, item->count());
+ name = strf("{} (x{})", name, item->count());
auto itemName = widget->fetchChild<LabelWidget>("itemName");
itemName->setText(name);
unsigned price = ceil(itemConfig.getInt("price", item->price()) * m_buyFactor);
- widget->setLabel("priceLabel", strf("%s", price));
+ widget->setLabel("priceLabel", strf("{}", price));
widget->setData(price);
bool unavailable = price > m_player->currency("money");
@@ -287,7 +287,7 @@ void MerchantPane::updateBuyTotal() {
else
m_buyTotal = 0;
- m_buyTotalLabel->setText(strf("%s", m_buyTotal));
+ m_buyTotalLabel->setText(strf("{}", m_buyTotal));
if (m_selectedIndex != NPos && m_buyCount > 0)
m_buyButton->enable();
@@ -332,7 +332,7 @@ void MerchantPane::updateSellTotal() {
if (item)
m_sellTotal += round(item->price() * m_sellFactor);
}
- m_sellTotalLabel->setText(strf("%s", m_sellTotal));
+ m_sellTotalLabel->setText(strf("{}", m_sellTotal));
if (m_sellTotal > 0)
m_sellButton->enable();
else
@@ -366,7 +366,7 @@ int MerchantPane::maxBuyCount() {
}
void MerchantPane::countChanged() {
- m_countTextBox->setText(strf("x%s", m_buyCount));
+ m_countTextBox->setText(strf("x{}", m_buyCount));
updateBuyTotal();
}
diff --git a/source/frontend/StarQuestInterface.cpp b/source/frontend/StarQuestInterface.cpp
index cb1f3e5..fa42b4d 100644
--- a/source/frontend/StarQuestInterface.cpp
+++ b/source/frontend/StarQuestInterface.cpp
@@ -236,7 +236,7 @@ void QuestLogInterface::fetchData() {
else if (filter.equalsIgnoreCase("completed"))
showQuests(m_manager->listCompletedQuests());
else
- throw StarException(strf("Unknown quest filter '%s'", filter));
+ throw StarException(strf("Unknown quest filter '{}'", filter));
}
void QuestLogInterface::showQuests(List<QuestPtr> quests) {
@@ -422,7 +422,7 @@ QuestCompleteInterface::QuestCompleteInterface(QuestPtr const& quest, PlayerPtr
commonSetup(config, m_quest->completionText(), "QuestComplete");
if (auto moneyLabel = fetchChild<LabelWidget>("lblMoneyAmount"))
- moneyLabel->setText(strf("%s", m_quest->money()));
+ moneyLabel->setText(strf("{}", m_quest->money()));
disableScissoring();
}
diff --git a/source/frontend/StarRadioMessagePopup.cpp b/source/frontend/StarRadioMessagePopup.cpp
index 6603dcf..f7c9061 100644
--- a/source/frontend/StarRadioMessagePopup.cpp
+++ b/source/frontend/StarRadioMessagePopup.cpp
@@ -51,7 +51,7 @@ void RadioMessagePopup::update() {
if (m_popupStage == PopupStage::AnimateIn) {
int frame = floor((1.0f - m_stageTimer.percent()) * m_animateInFrames);
- setBG("", strf("%s:%s", m_animateInImage, frame), "");
+ setBG("", strf("{}:{}", m_animateInImage, frame), "");
} else if (m_popupStage == PopupStage::ScrollText) {
int frame =
int((m_stageTimer.timer / m_message.portraitSpeed) * m_message.portraitFrames) % m_message.portraitFrames;
@@ -62,7 +62,7 @@ void RadioMessagePopup::update() {
// you're cool, just stay cool, cool person
} else if (m_popupStage == PopupStage::AnimateOut) {
int frame = floor((1.0f - m_stageTimer.percent()) * m_animateOutFrames);
- setBG("", strf("%s:%s", m_animateOutImage, frame), "");
+ setBG("", strf("{}:{}", m_animateOutImage, frame), "");
}
m_slideTimer = min(m_slideTimer + WorldTimestep, m_slideTime);
@@ -128,7 +128,7 @@ void RadioMessagePopup::enterStage(PopupStage newStage) {
if (m_popupStage == PopupStage::Hidden) {
m_portraitImage->hide();
m_messageLabel->hide();
- setBG("", strf("%s:0", m_animateInImage), "");
+ setBG("", strf("{}:0", m_animateInImage), "");
} else if (m_popupStage == PopupStage::AnimateIn) {
m_stageTimer = GameTimer(m_animateInTime);
m_portraitImage->hide();
diff --git a/source/frontend/StarScriptPane.cpp b/source/frontend/StarScriptPane.cpp
index 87c1353..e2e8a33 100644
--- a/source/frontend/StarScriptPane.cpp
+++ b/source/frontend/StarScriptPane.cpp
@@ -179,7 +179,7 @@ LuaCallbacks ScriptPane::makePaneCallbacks() {
});
callbacks.registerCallback("addWidget", [this](Json const& newWidgetConfig, Maybe<String> const& newWidgetName) {
- String name = newWidgetName.value(strf("%d", Random::randu64()));
+ String name = newWidgetName.value(strf("{}", Random::randu64()));
WidgetPtr newWidget = m_reader.makeSingle(name, newWidgetConfig);
this->addChild(name, newWidget);
});
diff --git a/source/frontend/StarTeamBar.cpp b/source/frontend/StarTeamBar.cpp
index 48a9b51..6091d9c 100644
--- a/source/frontend/StarTeamBar.cpp
+++ b/source/frontend/StarTeamBar.cpp
@@ -159,7 +159,7 @@ void TeamBar::buildTeamBar() {
continue;
}
- String cellName = strf("%s", controlIndex);
+ String cellName = strf("{}", controlIndex);
WidgetPtr cell = list->fetchChild(cellName);
if (!cell) {
@@ -231,7 +231,7 @@ void TeamBar::buildTeamBar() {
noInviteImage->setVisibility(!couldInvite);
while (true) {
- String cellName = strf("%s", controlIndex);
+ String cellName = strf("{}", controlIndex);
WidgetPtr cell = list->fetchChild(cellName);
if (!cell)
break;
diff --git a/source/frontend/StarTeleportDialog.cpp b/source/frontend/StarTeleportDialog.cpp
index eef6250..76f0310 100644
--- a/source/frontend/StarTeleportDialog.cpp
+++ b/source/frontend/StarTeleportDialog.cpp
@@ -57,7 +57,7 @@ TeleportDialog::TeleportDialog(UniverseClientPtr client,
entry->fetchChild<LabelWidget>("planetName")->setText(dest.getString("planetName", ""));
if (dest.contains("icon"))
entry->fetchChild<ImageWidget>("icon")->setImage(
- strf("/interface/bookmarks/icons/%s.png", dest.getString("icon")));
+ strf("/interface/bookmarks/icons/{}.png", dest.getString("icon")));
entry->fetchChild<ButtonWidget>("editButton")->hide();
if (dest.getBool("mission", false)) {
diff --git a/source/frontend/StarWidgetLuaBindings.cpp b/source/frontend/StarWidgetLuaBindings.cpp
index 1029daa..eb3ff5b 100644
--- a/source/frontend/StarWidgetLuaBindings.cpp
+++ b/source/frontend/StarWidgetLuaBindings.cpp
@@ -180,7 +180,7 @@ LuaCallbacks LuaBindings::makeWidgetCallbacks(Widget* parentWidget, GuiReader* r
callbacks.registerCallback("addChild", [parentWidget, reader](String const& widgetName, Json const& newChildConfig, Maybe<String> const& newChildName) {
if (auto widget = parentWidget->fetchChild<Widget>(widgetName)) {
- String name = newChildName.value(strf("%d", Random::randu64()));
+ String name = newChildName.value(strf("{}", Random::randu64()));
WidgetPtr newChild = reader->makeSingle(name, newChildConfig);
widget->addChild(name, newChild);
}