refactor: add renderCoinsFromCopper() to eliminate copper decomposition boilerplate

Add renderCoinsFromCopper(uint64_t) overload in ui_colors.hpp that
decomposes copper into gold/silver/copper and renders. Replace 14
manual 3-line decomposition blocks across game_screen and
inventory_screen with single-line calls.
This commit is contained in:
Kelsi 2026-03-25 12:59:31 -07:00
parent f39271453b
commit 25d1a7742d
3 changed files with 24 additions and 52 deletions

View file

@ -3074,11 +3074,8 @@ void InventoryScreen::renderItemTooltip(const game::ItemDef& item, const game::I
}
if (item.sellPrice > 0) {
uint32_t g = item.sellPrice / 10000;
uint32_t s = (item.sellPrice / 100) % 100;
uint32_t c = item.sellPrice % 100;
ImGui::TextDisabled("Sell:"); ImGui::SameLine(0, 4);
renderCoinsText(g, s, c);
renderCoinsFromCopper(item.sellPrice);
}
// Shift-hover comparison with currently equipped equivalent.
@ -3734,11 +3731,8 @@ void InventoryScreen::renderItemTooltip(const game::ItemQueryResponseData& info,
}
if (info.sellPrice > 0) {
uint32_t g = info.sellPrice / 10000;
uint32_t s = (info.sellPrice / 100) % 100;
uint32_t c = info.sellPrice % 100;
ImGui::TextDisabled("Sell:"); ImGui::SameLine(0, 4);
renderCoinsText(g, s, c);
renderCoinsFromCopper(info.sellPrice);
}
// Shift-hover: compare with currently equipped item