2022-10-28 16:54:33 +02:00
|
|
|
#include "services/vehicle/handling_service.hpp"
|
2022-05-04 19:16:40 +02:00
|
|
|
#include "views/view.hpp"
|
2021-09-20 01:11:01 +02:00
|
|
|
|
|
|
|
namespace big
|
|
|
|
{
|
2022-05-04 19:16:40 +02:00
|
|
|
void view::handling_saved_profiles()
|
2021-09-20 01:11:01 +02:00
|
|
|
{
|
2022-05-04 19:16:40 +02:00
|
|
|
if (g_local_player == nullptr || g_local_player->m_vehicle == nullptr || g_local_player->m_ped_task_flag & (int)ePedTask::TASK_FOOT)
|
2021-09-20 01:11:01 +02:00
|
|
|
{
|
2022-05-04 19:16:40 +02:00
|
|
|
ImGui::Text("Please enter a vehicle.");
|
|
|
|
return;
|
|
|
|
}
|
2022-10-28 16:54:33 +02:00
|
|
|
g_handling_service->backup_vehicle();
|
2022-05-04 19:16:40 +02:00
|
|
|
|
2022-10-28 16:54:33 +02:00
|
|
|
if (components::button("Reload Profiles"))
|
2022-05-04 19:16:40 +02:00
|
|
|
{
|
2022-10-28 16:54:33 +02:00
|
|
|
g_handling_service->load_files();
|
|
|
|
}
|
2021-09-20 01:11:01 +02:00
|
|
|
|
|
|
|
|
2022-10-28 16:54:33 +02:00
|
|
|
if (ImGui::ListBoxHeader("##handling_profiles"))
|
|
|
|
{
|
2022-12-17 15:11:36 +01:00
|
|
|
for (auto& [name, profile] : g_handling_service->profiles())
|
2022-10-28 16:54:33 +02:00
|
|
|
{
|
2022-12-17 15:11:36 +01:00
|
|
|
if (components::selectable(name, &profile == g_handling_service->active_profile()))
|
2022-10-28 16:54:33 +02:00
|
|
|
{
|
2022-12-17 15:11:36 +01:00
|
|
|
g_handling_service->apply_profile(&profile);
|
2021-09-20 01:11:01 +02:00
|
|
|
}
|
|
|
|
}
|
2022-10-28 16:54:33 +02:00
|
|
|
ImGui::EndListBox();
|
2021-09-20 01:11:01 +02:00
|
|
|
}
|
|
|
|
}
|
2022-05-04 19:16:40 +02:00
|
|
|
}
|