input for xml transport (#3207)

This commit is contained in:
CringeArab 2024-06-01 00:55:44 +03:00 committed by GitHub
parent 8f179007e1
commit 9baaf42b79

View File

@ -8,6 +8,11 @@ namespace big
{ {
void view::xml_vehicles() void view::xml_vehicles()
{ {
static char search[64];
components::input_text_with_hint("MODEL_NAME"_T, "SEARCH"_T, search, IM_ARRAYSIZE(search), ImGuiInputTextFlags_None);
std::string lower_search = search;
std::transform(lower_search.begin(), lower_search.end(), lower_search.begin(), tolower);
ImGui::BeginGroup(); ImGui::BeginGroup();
components::button("Reload", [] { components::button("Reload", [] {
@ -17,11 +22,16 @@ namespace big
{ {
for (auto& [name, doc] : g_xml_vehicles_service->m_all_xml_vehicles) for (auto& [name, doc] : g_xml_vehicles_service->m_all_xml_vehicles)
{ {
components::selectable(name, false, [&doc] { std::string lower_name = name;
auto handle = g_xml_vehicles_service->spawn_from_xml(doc, self::pos); std::transform(lower_name.begin(), lower_name.end(), lower_name.begin(), tolower);
if (g.spawn_vehicle.spawn_inside) if (lower_name.find(lower_search) != std::string::npos)
vehicle::teleport_into_vehicle(handle); {
}); components::selectable(name, false, [&doc] {
auto handle = g_xml_vehicles_service->spawn_from_xml(doc, self::pos);
if (g.spawn_vehicle.spawn_inside)
vehicle::teleport_into_vehicle(handle);
});
}
} }
ImGui::EndListBox(); ImGui::EndListBox();