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

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/windowing/StarItemSlotWidget.cpp35
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()));