Show all buyback items in vendor window (not just the most recent)

This commit is contained in:
Kelsi 2026-03-11 23:08:35 -07:00
parent 682cb8d44b
commit 745768511b

View file

@ -8324,10 +8324,9 @@ void GameScreen::renderVendorWindow(game::GameHandler& gameHandler) {
ImGui::TableSetupColumn("Price", ImGuiTableColumnFlags_WidthFixed, 110.0f); ImGui::TableSetupColumn("Price", ImGuiTableColumnFlags_WidthFixed, 110.0f);
ImGui::TableSetupColumn("Buy", ImGuiTableColumnFlags_WidthFixed, 62.0f); ImGui::TableSetupColumn("Buy", ImGuiTableColumnFlags_WidthFixed, 62.0f);
ImGui::TableHeadersRow(); ImGui::TableHeadersRow();
// Show only the most recently sold item (LIFO). // Show all buyback items (most recently sold first)
const int i = 0; for (int i = 0; i < static_cast<int>(buyback.size()); ++i) {
const auto& entry = buyback[0]; const auto& entry = buyback[i];
// Proactively ensure buyback item info is loaded
gameHandler.ensureItemInfo(entry.item.itemId); gameHandler.ensureItemInfo(entry.item.itemId);
auto* bbInfo = gameHandler.getItemInfo(entry.item.itemId); auto* bbInfo = gameHandler.getItemInfo(entry.item.itemId);
uint32_t sellPrice = entry.item.sellPrice; uint32_t sellPrice = entry.item.sellPrice;
@ -8370,11 +8369,14 @@ void GameScreen::renderVendorWindow(game::GameHandler& gameHandler) {
if (!canAfford) ImGui::PopStyleColor(); if (!canAfford) ImGui::PopStyleColor();
ImGui::TableSetColumnIndex(3); ImGui::TableSetColumnIndex(3);
if (!canAfford) ImGui::BeginDisabled(); if (!canAfford) ImGui::BeginDisabled();
if (ImGui::SmallButton("Buy Back##buyback_0")) { char bbLabel[32];
gameHandler.buyBackItem(0); snprintf(bbLabel, sizeof(bbLabel), "Buy Back##bb%d", i);
if (ImGui::SmallButton(bbLabel)) {
gameHandler.buyBackItem(static_cast<uint32_t>(i));
} }
if (!canAfford) ImGui::EndDisabled(); if (!canAfford) ImGui::EndDisabled();
ImGui::PopID(); ImGui::PopID();
}
ImGui::EndTable(); ImGui::EndTable();
} }
ImGui::Separator(); ImGui::Separator();