diff options
author | grbr404 <166065505+grbr404@users.noreply.github.com> | 2025-06-05 19:51:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-05 19:51:31 +0200 |
commit | 442964bb330a0337d12aab607b9ce7b1b8a20af6 (patch) | |
tree | 2c835fcf8a9f74408478cf5e8a7acdfd6822560d /source | |
parent | 2b76e9fed1d0d0ec909d1cd36893ac38bbd88c06 (diff) |
Update StarItemSlotWidget.cpp
Diffstat (limited to 'source')
-rw-r--r-- | source/windowing/StarItemSlotWidget.cpp | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/source/windowing/StarItemSlotWidget.cpp b/source/windowing/StarItemSlotWidget.cpp index 41fbc20..c8aa79c 100644 --- a/source/windowing/StarItemSlotWidget.cpp +++ b/source/windowing/StarItemSlotWidget.cpp @@ -185,32 +185,27 @@ void ItemSlotWidget::renderImpl() { } } - if (m_item->count() > 1 && m_showCount) { // we don't need to tell people that there's only 1 of something - uint32_t count = m_item->count();Add commentMore actions - std::string formattedCount; - - if (count >= 1000000000000000) { // Quadrillions (Q) - formattedCount = toString(count / 1000000000000000) + "Q"; - } else if (count >= 1000000000) { // Billions (B) - formattedCount = toString(count / 1000000000) + "B"; - } else if (count >= 1000000) { // Millions (M) - formattedCount = toString(count / 1000000) + "M"; - } else if (count >= 1000) { // Thousands (K) - formattedCount = toString(count / 1000) + "K"; - } else { - formattedCount = toString(count); - } - - // Ensure formatted count is at most 4 characters long - if (formattedCount.length() > 4) { - formattedCount = formattedCount.substr(0, 4); +if (m_item->count() > 1 && m_showCount) { // we don't need to tell people that there's only 1 of something + uint32_t count = m_item->count(); + std::string formattedCount; + + if (count >= 1000000000000000) { // Quadrillions (Q) + formattedCount = toString(count / 1000000000000000) + "Q"; + } else if (count >= 1000000000) { // Billions (B) + formattedCount = toString(count / 1000000000) + "B"; + } else if (count >= 1000000) { // Millions (M) + formattedCount = toString(count / 1000000) + "M"; + } else if (count >= 1000) { // Thousands (K) + formattedCount = toString(count / 1000) + "K"; + } else { + formattedCount = toString(count); } context()->setTextStyle(m_textStyle); context()->setFontMode(m_countFontMode); context()->renderInterfaceText(formattedCount, m_countPosition.translated(Vec2F(screenPosition()))); context()->clearTextStyle(); - } +} } else if (m_drawBackingImageWhenEmpty && m_backingImage != "") { context()->drawInterfaceQuad(m_backingImage, Vec2F(screenPosition())); |