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

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2023-07-06 19:26:28 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2023-07-06 19:26:28 +1000
commitfe4cc1961888db364bbc70cfe0e7a15ec27a5c5b (patch)
treedb5357973b2e2ef368b6c1f81a701b8ea75b9a9b
parentf75d1f0b5a78bfce56bde4fe57b8d1193a340e74 (diff)
Change pure string format calls to use fmt::to_string
-rw-r--r--source/application/StarP2PNetworkingService_pc.cpp4
-rw-r--r--source/base/StarAssets.cpp2
-rw-r--r--source/client/StarClientApplication.cpp10
-rw-r--r--source/core/StarFormat.hpp5
-rw-r--r--source/core/StarLexicalCast.hpp5
-rw-r--r--source/core/StarLogging.hpp2
-rw-r--r--source/frontend/StarCinematic.cpp2
-rw-r--r--source/frontend/StarClientCommandProcessor.cpp2
-rw-r--r--source/frontend/StarContainerInterface.cpp2
-rw-r--r--source/frontend/StarCraftingInterface.cpp4
-rw-r--r--source/frontend/StarInventory.cpp10
-rw-r--r--source/frontend/StarItemTooltip.cpp6
-rw-r--r--source/frontend/StarMainInterface.cpp2
-rw-r--r--source/frontend/StarMerchantInterface.cpp6
-rw-r--r--source/frontend/StarQuestInterface.cpp2
-rw-r--r--source/frontend/StarTeamBar.cpp4
-rw-r--r--source/game/StarMonster.cpp2
-rw-r--r--source/game/StarSystemWorldServer.cpp4
-rw-r--r--source/game/StarWorldClient.cpp4
-rw-r--r--source/game/items/StarTools.cpp6
-rw-r--r--source/game/objects/StarContainerObject.cpp2
-rw-r--r--source/windowing/StarItemGridWidget.cpp2
-rw-r--r--source/windowing/StarItemSlotWidget.cpp2
-rw-r--r--source/windowing/StarListWidget.cpp6
-rw-r--r--source/windowing/StarWidgetLuaBindings.cpp2
-rw-r--r--source/windowing/StarWidgetParsing.cpp4
26 files changed, 51 insertions, 51 deletions
diff --git a/source/application/StarP2PNetworkingService_pc.cpp b/source/application/StarP2PNetworkingService_pc.cpp
index 74c48ac..0170eb0 100644
--- a/source/application/StarP2PNetworkingService_pc.cpp
+++ b/source/application/StarP2PNetworkingService_pc.cpp
@@ -108,7 +108,7 @@ void Star::PcP2PNetworkingService::setActivityData(String const& title, Maybe<pa
}
if (auto lobby = m_discordServerLobby)
- activity.GetParty().SetId(strf("{}", lobby->first).c_str());
+ activity.GetParty().SetId(toString(lobby->first).c_str());
if (m_joinLocation.is<JoinLocal>()) {
if (auto lobby = m_discordServerLobby) {
@@ -117,7 +117,7 @@ void Star::PcP2PNetworkingService::setActivityData(String const& title, Maybe<pa
activity.GetSecrets().SetJoin(joinSecret.utf8Ptr());
}
} else if (m_joinLocation.is<JoinRemote>()) {
- String address = strf("{}", (HostAddressWithPort)m_joinLocation.get<JoinRemote>());
+ String address = toString((HostAddressWithPort)m_joinLocation.get<JoinRemote>());
String joinSecret = strf("connect:address_{}", address);
Logger::info("Setting discord join secret as {}", joinSecret);
activity.GetSecrets().SetJoin(joinSecret.utf8Ptr());
diff --git a/source/base/StarAssets.cpp b/source/base/StarAssets.cpp
index 0eb5725..7efceb3 100644
--- a/source/base/StarAssets.cpp
+++ b/source/base/StarAssets.cpp
@@ -431,7 +431,7 @@ FramesSpecification Assets::parseFramesSpecification(Json const& frameConfig, St
// If "names" not specified, use auto naming algorithm
for (size_t y = 0; y < dimensions[1]; ++y)
for (size_t x = 0; x < dimensions[0]; ++x)
- framesSpecification.frames[strf("{}", y * dimensions[0] + x)] =
+ framesSpecification.frames[toString(y * dimensions[0] + x)] =
RectU::withSize(Vec2U(begin[0] + x * size[0], begin[1] + y * size[1]), size);
}
}
diff --git a/source/client/StarClientApplication.cpp b/source/client/StarClientApplication.cpp
index d58ed69..2ed90ab 100644
--- a/source/client/StarClientApplication.cpp
+++ b/source/client/StarClientApplication.cpp
@@ -234,7 +234,7 @@ void ClientApplication::renderInit(RendererPtr renderer) {
};
loadEffectConfig("world");
- loadEffectConfig("default");
+ loadEffectConfig("interface");
if (m_root->configuration()->get("limitTextureAtlasSize").optBool().value(false))
renderer->setSizeLimitEnabled(true);
@@ -389,11 +389,11 @@ void ClientApplication::render() {
WorldClientPtr worldClient = m_universeClient->worldClient();
RendererPtr renderer = Application::renderer();
+ renderer->switchEffectConfig("world");
if (worldClient) {
auto totalStart = Time::monotonicMicroseconds();
auto start = totalStart;
- renderer->switchEffectConfig("world");
worldClient->render(m_renderData, TilePainter::BorderTileSize);
LogMap::set("client_render_world_client", strf(u8"{:05d}\u00b5s", Time::monotonicMicroseconds() - start));
@@ -404,10 +404,10 @@ void ClientApplication::render() {
start = Time::monotonicMicroseconds();
m_mainInterface->renderInWorldElements();
LogMap::set("client_render_world_elements", strf(u8"{:05d}\u00b5s", Time::monotonicMicroseconds() - start));
- renderer->switchEffectConfig("default");
LogMap::set("client_render_world_total", strf(u8"{:05d}\u00b5s", Time::monotonicMicroseconds() - totalStart));
}
+ renderer->switchEffectConfig("interface");
auto start = Time::monotonicMicroseconds();
m_mainInterface->render();
m_cinematicOverlay->render();
@@ -879,8 +879,8 @@ void ClientApplication::updateRunning() {
LogMap::set("player_vel", strf("[ ^#f45;{:4.2f}^reset;, ^#49f;{:4.2f}^reset; ]", m_player->velocity()[0], m_player->velocity()[1]));
LogMap::set("player_aim", strf("[ ^#f45;{:4.2f}^reset;, ^#49f;{:4.2f}^reset; ]", aimPosition[0], aimPosition[1]));
if (m_universeClient->worldClient()) {
- LogMap::set("tile_liquid_level", strf("{}", m_universeClient->worldClient()->liquidLevel(Vec2I::floor(aimPosition)).level));
- LogMap::set("tile_dungeon_id", strf("{}", m_universeClient->worldClient()->dungeonId(Vec2I::floor(aimPosition))));
+ LogMap::set("tile_liquid_level", toString(m_universeClient->worldClient()->liquidLevel(Vec2I::floor(aimPosition)).level));
+ LogMap::set("tile_dungeon_id", toString(m_universeClient->worldClient()->dungeonId(Vec2I::floor(aimPosition))));
}
if (m_mainInterface->currentState() == MainInterface::ReturnToTitle)
diff --git a/source/core/StarFormat.hpp b/source/core/StarFormat.hpp
index c31697f..f159928 100644
--- a/source/core/StarFormat.hpp
+++ b/source/core/StarFormat.hpp
@@ -40,6 +40,11 @@ void cerrf(char const* fmt, Args const&... args) {
std::cerr.flush();
}
+template <class Type>
+inline std::string toString(Type const& t) {
+ return fmt::to_string(t);
+}
+
}
#endif
diff --git a/source/core/StarLexicalCast.hpp b/source/core/StarLexicalCast.hpp
index 40e6d6d..abda912 100644
--- a/source/core/StarLexicalCast.hpp
+++ b/source/core/StarLexicalCast.hpp
@@ -42,11 +42,6 @@ Type lexicalCast(StringView s, std::ios_base::fmtflags flags = std::ios_base::bo
throw BadLexicalCast(strf("Lexical cast failed on '{}'", s));
}
-template <class Type>
-std::string toString(Type const& t) {
- return fmt::to_string(t);
-}
-
}
#endif
diff --git a/source/core/StarLogging.hpp b/source/core/StarLogging.hpp
index ae47e40..3e71aff 100644
--- a/source/core/StarLogging.hpp
+++ b/source/core/StarLogging.hpp
@@ -185,7 +185,7 @@ void Logger::error(char const* msg, Args const&... args) {
template <typename T>
void LogMap::set(String const& key, T const& t) {
- setValue(key, strf("{}", t));
+ setValue(key, toString(t));
}
}
diff --git a/source/frontend/StarCinematic.cpp b/source/frontend/StarCinematic.cpp
index 7470410..bf39bd0 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("{}", ((int)values.frame) % panel->animationFrames);
+ auto frame = toString(((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 0f78ea0..7b6e234 100644
--- a/source/frontend/StarClientCommandProcessor.cpp
+++ b/source/frontend/StarClientCommandProcessor.cpp
@@ -127,7 +127,7 @@ String ClientCommandProcessor::gravity() {
if (!adminCommandAllowed())
return "You must be an admin to use this command.";
- return strf("{}", m_universeClient->worldClient()->gravity(m_universeClient->mainPlayer()->position()));
+ return toString(m_universeClient->worldClient()->gravity(m_universeClient->mainPlayer()->position()));
}
String ClientCommandProcessor::debug(StringList const& arguments) {
diff --git a/source/frontend/StarContainerInterface.cpp b/source/frontend/StarContainerInterface.cpp
index 10da82f..5a69fda 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("{}", container->containerSize())));
+ countWidget->setText(countWidget->text().replace("<slots>", toString(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 f3cedf5..df0100a 100644
--- a/source/frontend/StarCraftingInterface.cpp
+++ b/source/frontend/StarCraftingInterface.cpp
@@ -294,7 +294,7 @@ void CraftingPane::update() {
updateCraftButtons();
}
- setLabel("lblPlayerMoney", strf("{}", (int)m_player->currency("money")));
+ setLabel("lblPlayerMoney", toString((int)m_player->currency("money")));
Pane::update();
}
@@ -421,7 +421,7 @@ void CraftingPane::setupWidget(WidgetPtr const& widget, ItemRecipe const& recipe
}
if (price > 0) {
- widget->setLabel("priceLabel", strf("{}", price));
+ widget->setLabel("priceLabel", toString(price));
if (auto icon = widget->fetchChild<ImageWidget>("moneyIcon"))
icon->setVisibility(true);
} else {
diff --git a/source/frontend/StarInventory.cpp b/source/frontend/StarInventory.cpp
index a5a17e1..850eedf 100644
--- a/source/frontend/StarInventory.cpp
+++ b/source/frontend/StarInventory.cpp
@@ -317,25 +317,25 @@ void InventoryPane::update() {
techOverlay->setVisibility(m_player->techOverridden());
auto healthLabel = fetchChild<LabelWidget>("healthtext");
- healthLabel->setText(strf("{}", m_player->maxHealth()));
+ healthLabel->setText(toString(m_player->maxHealth()));
auto energyLabel = fetchChild<LabelWidget>("energytext");
- energyLabel->setText(strf("{}", m_player->maxEnergy()));
+ energyLabel->setText(toString(m_player->maxEnergy()));
auto weaponLabel = fetchChild<LabelWidget>("weapontext");
weaponLabel->setText(strf("{}%", ceil(m_player->powerMultiplier() * 100)));
auto defenseLabel = fetchChild<LabelWidget>("defensetext");
if (m_player->protection() == 0)
defenseLabel->setText("--");
else
- defenseLabel->setText(strf("{}", ceil(m_player->protection())));
+ defenseLabel->setText(toString(ceil(m_player->protection())));
auto moneyLabel = fetchChild<LabelWidget>("lblMoney");
- moneyLabel->setText(strf("{}", m_player->currency("money")));
+ moneyLabel->setText(toString(m_player->currency("money")));
if (m_player->currency("essence") > 0) {
fetchChild<ImageWidget>("imgEssenceIcon")->show();
auto essenceLabel = fetchChild<LabelWidget>("lblEssence");
essenceLabel->show();
- essenceLabel->setText(strf("{}", m_player->currency("essence")));
+ essenceLabel->setText(toString(m_player->currency("essence")));
} else {
fetchChild<ImageWidget>("imgEssenceIcon")->hide();
fetchChild<LabelWidget>("lblEssence")->hide();
diff --git a/source/frontend/StarItemTooltip.cpp b/source/frontend/StarItemTooltip.cpp
index 46a2d85..8d7ee29 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("{}", item->count()));
+ container->setLabel("countLabel", toString(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("{}", item->instanceValue("fuelAmount", 0).toUInt() * item->count()));
- container->setLabel("priceLabel", strf("{}", (int)item->price()));
+ container->setLabel("countLabel", toString(item->instanceValue("fuelAmount", 0).toUInt() * item->count()));
+ container->setLabel("priceLabel", toString((int)item->price()));
if (auto objectItem = as<ObjectItem>(item)) {
try {
diff --git a/source/frontend/StarMainInterface.cpp b/source/frontend/StarMainInterface.cpp
index 9a47835..9f335b6 100644
--- a/source/frontend/StarMainInterface.cpp
+++ b/source/frontend/StarMainInterface.cpp
@@ -682,7 +682,7 @@ void MainInterface::update() {
}
m_messageOverflow++;
- m_overflowMessage->message = m_config->overflowMessageText.replace("<count>", strf("{}", m_messageOverflow));
+ m_overflowMessage->message = m_config->overflowMessageText.replace("<count>", toString(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;
diff --git a/source/frontend/StarMerchantInterface.cpp b/source/frontend/StarMerchantInterface.cpp
index 4db2771..c4b1047 100644
--- a/source/frontend/StarMerchantInterface.cpp
+++ b/source/frontend/StarMerchantInterface.cpp
@@ -242,7 +242,7 @@ void MerchantPane::setupWidget(WidgetPtr const& widget, Json const& itemConfig)
itemName->setText(name);
unsigned price = ceil(itemConfig.getInt("price", item->price()) * m_buyFactor);
- widget->setLabel("priceLabel", strf("{}", price));
+ widget->setLabel("priceLabel", toString(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("{}", m_buyTotal));
+ m_buyTotalLabel->setText(toString(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("{}", m_sellTotal));
+ m_sellTotalLabel->setText(toString(m_sellTotal));
if (m_sellTotal > 0)
m_sellButton->enable();
else
diff --git a/source/frontend/StarQuestInterface.cpp b/source/frontend/StarQuestInterface.cpp
index fa42b4d..324cbd8 100644
--- a/source/frontend/StarQuestInterface.cpp
+++ b/source/frontend/StarQuestInterface.cpp
@@ -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("{}", m_quest->money()));
+ moneyLabel->setText(toString(m_quest->money()));
disableScissoring();
}
diff --git a/source/frontend/StarTeamBar.cpp b/source/frontend/StarTeamBar.cpp
index 8bdd3b3..06b3ee7 100644
--- a/source/frontend/StarTeamBar.cpp
+++ b/source/frontend/StarTeamBar.cpp
@@ -162,7 +162,7 @@ void TeamBar::buildTeamBar() {
continue;
}
- String cellName = strf("{}", controlIndex);
+ String cellName = toString(controlIndex);
WidgetPtr cell = list->fetchChild(cellName);
if (!cell) {
@@ -234,7 +234,7 @@ void TeamBar::buildTeamBar() {
noInviteImage->setVisibility(!couldInvite);
while (true) {
- String cellName = strf("{}", controlIndex);
+ String cellName = toString(controlIndex);
WidgetPtr cell = list->fetchChild(cellName);
if (!cell)
break;
diff --git a/source/game/StarMonster.cpp b/source/game/StarMonster.cpp
index b91607a..59084dd 100644
--- a/source/game/StarMonster.cpp
+++ b/source/game/StarMonster.cpp
@@ -559,7 +559,7 @@ LuaCallbacks Monster::makeMonsterCallbacks() {
});
callbacks.registerCallback("seed", [this]() {
- return strf("{}", m_monsterVariant.seed);
+ return toString(m_monsterVariant.seed);
});
callbacks.registerCallback("uniqueParameters", [this]() {
diff --git a/source/game/StarSystemWorldServer.cpp b/source/game/StarSystemWorldServer.cpp
index 1f1dc66..ca1b828 100644
--- a/source/game/StarSystemWorldServer.cpp
+++ b/source/game/StarSystemWorldServer.cpp
@@ -314,7 +314,7 @@ Json SystemWorldServer::diskStore() {
void SystemWorldServer::placeInitialObjects() {
auto config = Root::singleton().assets()->json("/systemworld.config");
- RandomSource rand(staticRandomU64("SystemWorldGeneration", strf("{}", m_location)));
+ RandomSource rand(staticRandomU64("SystemWorldGeneration", toString(m_location)));
WeightedPool<JsonArray> spawnPools = jsonToWeightedPool<JsonArray>(config.getArray("initialObjectPools"));
JsonArray spawn = spawnPools.select(rand);
@@ -429,7 +429,7 @@ SkyParameters SystemWorldServer::locationSkyParameters(SystemLocation const& loc
if (auto visitableParameters = parameters->visitableParameters()) {
if (is<TerrestrialWorldParameters>(visitableParameters)) {
- uint64_t seed = staticRandomU64(strf("{}", m_location));
+ uint64_t seed = staticRandomU64(toString(m_location));
List<CelestialParameters> worlds;
if (auto planet = m_celestialDatabase->parameters(orbitTarget))
worlds.append(*planet);
diff --git a/source/game/StarWorldClient.cpp b/source/game/StarWorldClient.cpp
index f25c45b..d684c16 100644
--- a/source/game/StarWorldClient.cpp
+++ b/source/game/StarWorldClient.cpp
@@ -1057,7 +1057,7 @@ void WorldClient::update() {
renderCollisionDebug();
LogMap::set("client_entities", m_entityMap->size());
- LogMap::set("client_sectors", strf("{}", loadedSectors.size()));
+ LogMap::set("client_sectors", toString(loadedSectors.size()));
LogMap::set("client_lua_mem", m_luaRoot->luaMemoryUsage());
}
@@ -1244,7 +1244,7 @@ void WorldClient::handleDamageNotifications() {
return;
Particle particle = Root::singleton().particleDatabase()->particle(damageNumberParticleKind);
particle.position += position;
- particle.string = particle.string.replace("$dmg$", strf("{}", displayValue));
+ particle.string = particle.string.replace("$dmg$", toString(displayValue));
m_particles->add(particle);
};
diff --git a/source/game/items/StarTools.cpp b/source/game/items/StarTools.cpp
index 819e87a..178809d 100644
--- a/source/game/items/StarTools.cpp
+++ b/source/game/items/StarTools.cpp
@@ -19,7 +19,7 @@ MiningTool::MiningTool(Json const& config, String const& directory, Json const&
m_frameCycle = instanceValue("animationCycle", 1.0f).toFloat();
m_frameTiming = 0;
for (size_t i = 0; i < (size_t)m_frames; i++)
- m_animationFrame.append(m_image.replace("{frame}", strf("{}", i)));
+ m_animationFrame.append(m_image.replace("{frame}", toString(i)));
m_idleFrame = m_image.replace("{frame}", "idle");
m_handPosition = jsonToVec2F(instanceValue("handPosition"));
m_blockRadius = instanceValue("blockRadius").toFloat();
@@ -154,7 +154,7 @@ HarvestingTool::HarvestingTool(Json const& config, String const& directory, Json
m_frames = instanceValue("frames", 1).toInt();
m_frameCycle = instanceValue("animationCycle", 1.0f).toFloat();
for (size_t i = 0; i < (size_t)m_frames; i++)
- m_animationFrame.append(m_image.replace("{frame}", strf("{}", i)));
+ m_animationFrame.append(m_image.replace("{frame}", toString(i)));
m_idleFrame = m_image.replace("{frame}", "idle");
m_handPosition = jsonToVec2F(instanceValue("handPosition"));
@@ -494,7 +494,7 @@ TillingTool::TillingTool(Json const& config, String const& directory, Json const
m_frames = instanceValue("frames", 1).toInt();
m_frameCycle = instanceValue("animationCycle", 1.0f).toFloat();
for (size_t i = 0; i < (size_t)m_frames; i++)
- m_animationFrame.append(m_image.replace("{frame}", strf("{}", i)));
+ m_animationFrame.append(m_image.replace("{frame}", toString(i)));
m_idleFrame = m_image.replace("{frame}", "idle");
m_handPosition = jsonToVec2F(instanceValue("handPosition"));
diff --git a/source/game/objects/StarContainerObject.cpp b/source/game/objects/StarContainerObject.cpp
index 399c426..d013a3b 100644
--- a/source/game/objects/StarContainerObject.cpp
+++ b/source/game/objects/StarContainerObject.cpp
@@ -204,7 +204,7 @@ InteractAction ContainerObject::interact(InteractRequest const&) {
}
Json ContainerObject::containerGuiConfig() const {
- return Root::singleton().assets()->json(configValue("uiConfig").toString().replace("<slots>", strf("{}", m_items->size())));
+ return Root::singleton().assets()->json(configValue("uiConfig").toString().replace("<slots>", toString(m_items->size())));
}
String ContainerObject::containerDescription() const {
diff --git a/source/windowing/StarItemGridWidget.cpp b/source/windowing/StarItemGridWidget.cpp
index ad02c32..494d09c 100644
--- a/source/windowing/StarItemGridWidget.cpp
+++ b/source/windowing/StarItemGridWidget.cpp
@@ -155,7 +155,7 @@ void ItemGridWidget::setItemBag(ItemBagConstPtr bag) {
m_slots.clear();
for (size_t i = 0; i < m_bag->size() - m_bagOffset && i < (unsigned)m_dimensions[0] * m_dimensions[1]; ++i) {
auto itemSlot = make_shared<ItemSlotWidget>(m_bag->at(i), m_backingImage);
- addChild(strf("{}", i), itemSlot);
+ addChild(toString(i), itemSlot);
m_slots.append(itemSlot);
itemSlot->setBackingImageAffinity(m_drawBackingImageWhenFull, m_drawBackingImageWhenEmpty);
itemSlot->setProgress(m_progress);
diff --git a/source/windowing/StarItemSlotWidget.cpp b/source/windowing/StarItemSlotWidget.cpp
index cf12a8d..cc9ff50 100644
--- a/source/windowing/StarItemSlotWidget.cpp
+++ b/source/windowing/StarItemSlotWidget.cpp
@@ -185,7 +185,7 @@ void ItemSlotWidget::renderImpl() {
context()->setFontSize(m_fontSize);
context()->setFontColor(m_fontColor.toRgba());
context()->setFontMode(m_countFontMode);
- context()->renderInterfaceText(strf("{}", m_item->count()), m_countPosition.translated(Vec2F(screenPosition())));
+ context()->renderInterfaceText(toString(m_item->count()), m_countPosition.translated(Vec2F(screenPosition())));
}
} else if (m_drawBackingImageWhenEmpty && m_backingImage != "") {
diff --git a/source/windowing/StarListWidget.cpp b/source/windowing/StarListWidget.cpp
index 993fb73..c5ac35b 100644
--- a/source/windowing/StarListWidget.cpp
+++ b/source/windowing/StarListWidget.cpp
@@ -70,7 +70,7 @@ void ListWidget::setSchema(Json const& schema) {
WidgetPtr ListWidget::addItem() {
auto newItem = constructWidget();
- addChild(strf("{}", Random::randu64()), newItem);
+ addChild(toString(Random::randu64()), newItem);
updateSizeAndPosition();
return newItem;
@@ -78,7 +78,7 @@ WidgetPtr ListWidget::addItem() {
WidgetPtr ListWidget::addItem(size_t at) {
auto newItem = constructWidget();
- addChildAt(strf("{}", Random::randu64()), newItem, at);
+ addChildAt(toString(Random::randu64()), newItem, at);
updateSizeAndPosition();
if (m_selectedItem != NPos && at <= m_selectedItem)
@@ -88,7 +88,7 @@ WidgetPtr ListWidget::addItem(size_t at) {
}
WidgetPtr ListWidget::addItem(WidgetPtr existingItem) {
- addChild(strf("{}", Random::randu64()), existingItem);
+ addChild(toString(Random::randu64()), existingItem);
updateSizeAndPosition();
return existingItem;
diff --git a/source/windowing/StarWidgetLuaBindings.cpp b/source/windowing/StarWidgetLuaBindings.cpp
index 62d2be6..46f1ac8 100644
--- a/source/windowing/StarWidgetLuaBindings.cpp
+++ b/source/windowing/StarWidgetLuaBindings.cpp
@@ -186,7 +186,7 @@ LuaCallbacks LuaBindings::makeWidgetCallbacks(Widget* parentWidget, GuiReaderPtr
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("{}", Random::randu64()));
+ String name = newChildName.value(toString(Random::randu64()));
WidgetPtr newChild = reader->makeSingle(name, newChildConfig);
widget->addChild(name, newChild);
}
diff --git a/source/windowing/StarWidgetParsing.cpp b/source/windowing/StarWidgetParsing.cpp
index 8e27ecd..9afb825 100644
--- a/source/windowing/StarWidgetParsing.cpp
+++ b/source/windowing/StarWidgetParsing.cpp
@@ -360,7 +360,7 @@ WidgetConstructResult WidgetParser::radioGroupHandler(String const& name, Json c
common(button, btnConfig);
- buttonGroup->addChild(strf("{}", button->buttonGroupId()), button);
+ buttonGroup->addChild(toString(button->buttonGroupId()), button);
} catch (MapException const& e) {
throw WidgetParserException(
strf("Malformed gui json, missing a required value in the map. {}", outputException(e, false)));
@@ -749,7 +749,7 @@ WidgetConstructResult WidgetParser::stackHandler(String const& name, Json const&
auto widget = make_shared<Widget>();
constructImpl(widgetCfg, widget.get());
widget->determineSizeFromChildren();
- stack->addChild(strf("{}", stack->numChildren()), widget);
+ stack->addChild(toString(stack->numChildren()), widget);
}
}