mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 09:33:51 +00:00
Add spell search filter to trainer window
This commit is contained in:
parent
bbf4806fe8
commit
43c0e9b2e8
2 changed files with 21 additions and 1 deletions
|
|
@ -365,6 +365,9 @@ private:
|
||||||
// Vendor search filter
|
// Vendor search filter
|
||||||
char vendorSearchFilter_[128] = "";
|
char vendorSearchFilter_[128] = "";
|
||||||
|
|
||||||
|
// Trainer search filter
|
||||||
|
char trainerSearchFilter_[128] = "";
|
||||||
|
|
||||||
// Auction house UI state
|
// Auction house UI state
|
||||||
char auctionSearchName_[256] = "";
|
char auctionSearchName_[256] = "";
|
||||||
int auctionLevelMin_ = 0;
|
int auctionLevelMin_ = 0;
|
||||||
|
|
|
||||||
|
|
@ -8003,9 +8003,12 @@ void GameScreen::renderTrainerWindow(game::GameHandler& gameHandler) {
|
||||||
uint32_t mc = static_cast<uint32_t>(money % 100);
|
uint32_t mc = static_cast<uint32_t>(money % 100);
|
||||||
ImGui::Text("Your money: %ug %us %uc", mg, ms, mc);
|
ImGui::Text("Your money: %ug %us %uc", mg, ms, mc);
|
||||||
|
|
||||||
// Filter checkbox
|
// Filter controls
|
||||||
static bool showUnavailable = false;
|
static bool showUnavailable = false;
|
||||||
ImGui::Checkbox("Show unavailable spells", &showUnavailable);
|
ImGui::Checkbox("Show unavailable spells", &showUnavailable);
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::SetNextItemWidth(-1.0f);
|
||||||
|
ImGui::InputTextWithHint("##TrainerSearch", "Search...", trainerSearchFilter_, sizeof(trainerSearchFilter_));
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
if (trainer.spells.empty()) {
|
if (trainer.spells.empty()) {
|
||||||
|
|
@ -8055,6 +8058,20 @@ void GameScreen::renderTrainerWindow(game::GameHandler& gameHandler) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Apply text search filter
|
||||||
|
if (trainerSearchFilter_[0] != '\0') {
|
||||||
|
std::string trainerFilter(trainerSearchFilter_);
|
||||||
|
for (char& c : trainerFilter) c = static_cast<char>(std::tolower(static_cast<unsigned char>(c)));
|
||||||
|
const std::string& spellName = gameHandler.getSpellName(spell->spellId);
|
||||||
|
std::string nameLC = spellName.empty() ? std::to_string(spell->spellId) : spellName;
|
||||||
|
for (char& c : nameLC) c = static_cast<char>(std::tolower(static_cast<unsigned char>(c)));
|
||||||
|
if (nameLC.find(trainerFilter) == std::string::npos) {
|
||||||
|
ImGui::PushID(static_cast<int>(spell->spellId));
|
||||||
|
ImGui::PopID();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::TableNextRow();
|
ImGui::TableNextRow();
|
||||||
ImGui::PushID(static_cast<int>(spell->spellId));
|
ImGui::PushID(static_cast<int>(spell->spellId));
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue