fix(VehiclePreview): Issue w/ running fiber

This commit is contained in:
Yimura 2022-03-31 01:26:22 +02:00
parent b7db6b45dc
commit dac6cf8cc6
No known key found for this signature in database
GPG Key ID: 3D8FF4397E768682

View File

@ -42,16 +42,11 @@ namespace big
{
if (m_running)
return;
m_running = true;
static bool busy = false;
while (g_running && g->spawn.preview_vehicle && g_gui.m_opened)
{
if (busy)
continue;
busy = true;
g_fiber_pool->queue_job([this]
g_fiber_pool->queue_job([this]
{
while (g_running && g->spawn.preview_vehicle && g_gui.m_opened)
{
auto location = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(PLAYER::PLAYER_PED_ID(), 2.5f, 2.5f, .5f);
if (m_current_veh == -1)
@ -81,18 +76,13 @@ namespace big
if (m_heading += 0.5f; m_heading > 359) m_heading = 0;
busy = false;
});
}
script::get_current()->yield();
}
g_fiber_pool->queue_job([this]
{
entity::delete_entity(m_current_veh);
m_current_veh = -1;
m_running = false;
});
m_running = false;
}