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

@ -53,4 +53,11 @@ inline void renderCoinsText(uint32_t g, uint32_t s, uint32_t c) {
ImGui::TextColored(colors::kCopper, "%uc", c);
}
// Convenience overload: decompose copper amount and render as gold/silver/copper
inline void renderCoinsFromCopper(uint64_t copper) {
renderCoinsText(static_cast<uint32_t>(copper / 10000),
static_cast<uint32_t>((copper / 100) % 100),
static_cast<uint32_t>(copper % 100));
}
} // namespace wowee::ui