refactor: deduplicate item-set DBC key arrays, widen totem timer buffer

- Move itemKeys/spellKeys/thrKeys to shared kItemSetItemKeys/
  kItemSetSpellKeys/kItemSetThresholdKeys in ui_colors.hpp, removing
  5 identical local definitions across game_screen and inventory_screen
- Widen totem timer snprintf buffer from 8 to 16 bytes (defensive)
- Promote kStatTooltips to constexpr
This commit is contained in:
Kelsi 2026-03-27 14:40:44 -07:00
parent 92d8262f96
commit 4981d162c5
3 changed files with 25 additions and 26 deletions

View file

@ -1562,9 +1562,9 @@ void GameScreen::renderChatWindow(game::GameHandler& gameHandler) {
return layout ? (*layout)[k] : def;
};
uint32_t idF = lf("ID", 0), nameF = lf("Name", 1);
static const char* itemKeys[10] = {"Item0","Item1","Item2","Item3","Item4","Item5","Item6","Item7","Item8","Item9"};
static const char* spellKeys[10] = {"Spell0","Spell1","Spell2","Spell3","Spell4","Spell5","Spell6","Spell7","Spell8","Spell9"};
static const char* thrKeys[10] = {"Threshold0","Threshold1","Threshold2","Threshold3","Threshold4","Threshold5","Threshold6","Threshold7","Threshold8","Threshold9"};
const auto& itemKeys = ui::kItemSetItemKeys;
const auto& spellKeys = ui::kItemSetSpellKeys;
const auto& thrKeys = ui::kItemSetThresholdKeys;
for (uint32_t r = 0; r < dbc->getRecordCount(); ++r) {
uint32_t id = dbc->getUInt32(r, idF);
if (!id) continue;
@ -3577,7 +3577,7 @@ void GameScreen::renderPlayerFrame(game::GameHandler& gameHandler) {
tdl->AddRectFilled(ImVec2(x0, y0), ImVec2(fillX, y1),
ImGui::ColorConvertFloat4ToU32(kTotemColors[i]), 2.0f);
// Remaining seconds label
char secBuf[8];
char secBuf[16];
snprintf(secBuf, sizeof(secBuf), "%.0f", rem / 1000.0f);
ImVec2 tsz = ImGui::CalcTextSize(secBuf);
float lx = x0 + (slotW - tsz.x) * 0.5f;