From 83599ca6e2fee49cced9988d9e23b24a9af176d3 Mon Sep 17 00:00:00 2001 From: FileEX Date: Fri, 11 Aug 2023 23:37:06 +0200 Subject: [PATCH] Fixed wheel visibility when using setVehicleWheelStates #1556 --- .../mods/deathmatch/logic/CClientVehicle.cpp | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Client/mods/deathmatch/logic/CClientVehicle.cpp b/Client/mods/deathmatch/logic/CClientVehicle.cpp index db77e1fdb7..b2164615ec 100644 --- a/Client/mods/deathmatch/logic/CClientVehicle.cpp +++ b/Client/mods/deathmatch/logic/CClientVehicle.cpp @@ -1464,6 +1464,30 @@ void CClientVehicle::SetWheelStatus(unsigned char ucWheel, unsigned char ucStatu // Update the wheel's visibility m_pVehicle->SetWheelVisibility((eWheelPosition)ucWheel, (ucStatus != DT_WHEEL_MISSING)); + + // restart wheels component visibility (fix #1556) + std::map::iterator iter = m_ComponentData.begin(); + + for (; iter != m_ComponentData.end(); iter++) + { + SString strComponentName = (*iter).first; + if (strComponentName.BeginsWith("wheel_")) + { + unsigned char ucComponentWheel; + + if (strComponentName == "wheel_lf_dummy") + ucComponentWheel = FRONT_LEFT_WHEEL; + else if (strComponentName == "wheel_rf_dummy") + ucComponentWheel = FRONT_RIGHT_WHEEL; + else if (strComponentName == "wheel_lb_dummy") + ucComponentWheel = REAR_LEFT_WHEEL; + else if (strComponentName == "wheel_rb_dummy") + ucComponentWheel = REAR_RIGHT_WHEEL; + + if (ucComponentWheel == ucWheel && m_ucWheelStates[ucWheel] != DT_WHEEL_MISSING && ucStatus != DT_WHEEL_MISSING) + SetComponentVisible(strComponentName, (*iter).second.m_bVisible); + } + } } else if (m_eVehicleType == CLIENTVEHICLE_BIKE && ucWheel < 2) m_pVehicle->SetBikeWheelStatus(ucWheel, ucGTAStatus);