feat(PersonalVehicles): Alphabetic list
This commit is contained in:
parent
b7a0c39c02
commit
0167556de5
@ -53,16 +53,17 @@ namespace big
|
||||
{
|
||||
for (auto& it : g_mobile_service->m_personal_vehicles)
|
||||
{
|
||||
std::string label = it.first;
|
||||
auto& personal_veh = it.second;
|
||||
|
||||
std::string lower = personal_veh.get_display_name().c_str();
|
||||
std::string lower = label.c_str();
|
||||
std::transform(lower.begin(), lower.end(), lower.begin(), tolower);
|
||||
|
||||
if (lower.find(lower_search) != std::string::npos)
|
||||
{
|
||||
if (ImGui::Selectable(
|
||||
personal_veh.get_display_name().c_str(),
|
||||
personal_veh.get_id() == mobile::util::get_current_personal_vehicle()
|
||||
label.c_str(),
|
||||
personal_veh->get_id() == mobile::util::get_current_personal_vehicle()
|
||||
))
|
||||
{
|
||||
strcpy(search, "");
|
||||
@ -70,7 +71,7 @@ namespace big
|
||||
|
||||
QUEUE_JOB_BEGIN_CLAUSE(&personal_veh)
|
||||
{
|
||||
personal_veh.summon();
|
||||
personal_veh->summon();
|
||||
}QUEUE_JOB_END_CLAUSE
|
||||
}
|
||||
}
|
||||
|
@ -56,10 +56,20 @@ namespace big
|
||||
Hash hash = *veh_idx_global.at(66).as<Hash*>();
|
||||
if (STREAMING::IS_MODEL_A_VEHICLE(hash))
|
||||
{
|
||||
if (auto& it = m_personal_vehicles.find(i); it != m_personal_vehicles.end() && it->second.get_hash() != hash)
|
||||
it->second = PersonalVehicle(i, veh_idx_global);
|
||||
else
|
||||
m_personal_vehicles.emplace(i, PersonalVehicle(i, veh_idx_global));
|
||||
auto veh = std::make_unique<PersonalVehicle>(i, veh_idx_global);
|
||||
|
||||
if (auto& it = m_pv_lookup.find(i); it != m_pv_lookup.end())
|
||||
{
|
||||
m_personal_vehicles.erase(it->second);
|
||||
|
||||
it->second = veh->get_display_name();
|
||||
m_personal_vehicles.emplace(veh->get_display_name(), std::move(veh));
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
m_pv_lookup.emplace(i, veh->get_display_name());
|
||||
m_personal_vehicles.emplace(veh->get_display_name(), std::move(veh));
|
||||
}
|
||||
|
||||
script::get_current()->yield();
|
||||
|
@ -29,7 +29,8 @@ namespace big
|
||||
|
||||
void register_vehicles();
|
||||
|
||||
std::map<int, PersonalVehicle> m_personal_vehicles;
|
||||
std::map<std::string, std::unique_ptr<PersonalVehicle>> m_personal_vehicles;
|
||||
std::map<int, std::string> m_pv_lookup;
|
||||
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user