refactor: Bad design around the preview service (#2877)

Closes #2875
Closes #2675
Closes #2077
This commit is contained in:
gir489 2024-03-26 18:37:50 -04:00 committed by GitHub
parent a5a5b07984
commit 399a5d3dec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 15 additions and 26 deletions

View File

@ -141,9 +141,7 @@ namespace big
}
else if (ImGui::IsItemHovered())
{
g_fiber_pool->queue_job([pair] {
g_model_preview_service->show_vehicle_persisted(pair);
});
g_model_preview_service->show_vehicle_persisted(pair);
}
ImGui::SameLine();

View File

@ -228,11 +228,8 @@ namespace big
}
else if (ImGui::IsItemHovered())
{
g_fiber_pool->queue_job([&personal_veh] {
g_model_preview_service->show_vehicle(
vehicle::get_owned_mods_from_vehicle_idx(personal_veh->get_vehicle_idx()),
g.clone_pv.spawn_maxed);
});
g_model_preview_service->show_vehicle(vehicle::get_owned_mods_from_vehicle_idx(personal_veh->get_vehicle_idx()),
g.clone_pv.spawn_maxed);
}
}
}

View File

@ -153,10 +153,8 @@ namespace big
}
else if (ImGui::IsItemHovered())
{
g_fiber_pool->queue_job([] {
g_model_preview_service->show_vehicle(vehicle::get_owned_mods_from_vehicle(self::veh),
g.spawn_vehicle.spawn_maxed);
});
g_model_preview_service->show_vehicle(vehicle::get_owned_mods_from_vehicle(self::veh),
g.spawn_vehicle.spawn_maxed);
}
}
}

View File

@ -292,11 +292,9 @@ namespace big
}
else if (ImGui::IsItemHovered())
{
g_fiber_pool->queue_job([] {
Ped ped = self::ped;
Hash hash = ENTITY::GET_ENTITY_MODEL(ped);
g_model_preview_service->show_ped(hash, ped);
});
Ped ped = self::ped;
Hash hash = ENTITY::GET_ENTITY_MODEL(ped);
g_model_preview_service->show_ped(hash, ped);
}
if (selected_ped_player_id == -1)
@ -323,15 +321,13 @@ namespace big
}
else if (ImGui::IsItemHovered())
{
g_fiber_pool->queue_job([plyr_id] {
auto plyr = g_player_service->get_by_id(plyr_id);
if (plyr)
{
Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(plyr->id());
Hash hash = ENTITY::GET_ENTITY_MODEL(ped);
g_model_preview_service->show_ped(hash, ped);
}
});
auto plyr = g_player_service->get_by_id(plyr_id);
if (plyr)
{
Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(plyr->id());
Hash hash = ENTITY::GET_ENTITY_MODEL(ped);
g_model_preview_service->show_ped(hash, ped);
}
}
ImGui::PopID();