diff --git a/Client/mods/deathmatch/logic/CClientVehicle.cpp b/Client/mods/deathmatch/logic/CClientVehicle.cpp index 2a637f26f4..03ce8b0aec 100644 --- a/Client/mods/deathmatch/logic/CClientVehicle.cpp +++ b/Client/mods/deathmatch/logic/CClientVehicle.cpp @@ -1464,7 +1464,7 @@ void CClientVehicle::SetWheelStatus(unsigned char ucWheel, unsigned char ucStatu m_pVehicle->GetDamageManager()->SetWheelStatus((eWheelPosition)(ucWheel), ucGTAStatus); // Update the wheel's visibility - m_pVehicle->SetWheelVisibility((eWheelPosition)ucWheel, (ucStatus != DT_WHEEL_MISSING)); + m_pVehicle->SetWheelVisibility((eWheelPosition)ucWheel, ucStatus != DT_WHEEL_MISSING && m_ComponentData[GetComponentNameForWheel(ucWheel)].m_bVisible); } else if (m_eVehicleType == CLIENTVEHICLE_BIKE && ucWheel < 2) m_pVehicle->SetBikeWheelStatus(ucWheel, ucGTAStatus); @@ -1473,6 +1473,26 @@ void CClientVehicle::SetWheelStatus(unsigned char ucWheel, unsigned char ucStatu } } +// +// Returns component name for eWheelPosition enum +// +SString CClientVehicle::GetComponentNameForWheel(unsigned char ucWheel) const noexcept +{ + switch (ucWheel) + { + case FRONT_LEFT_WHEEL: + return "wheel_lf_dummy"; + case FRONT_RIGHT_WHEEL: + return "wheel_rf_dummy"; + case REAR_LEFT_WHEEL: + return "wheel_lb_dummy"; + case REAR_RIGHT_WHEEL: + return "wheel_rb_dummy"; + default: + return ""; + } +} + // // Returns true if wheel should be invisible because of its state // diff --git a/Client/mods/deathmatch/logic/CClientVehicle.h b/Client/mods/deathmatch/logic/CClientVehicle.h index 090b3c33a4..1577c1c576 100644 --- a/Client/mods/deathmatch/logic/CClientVehicle.h +++ b/Client/mods/deathmatch/logic/CClientVehicle.h @@ -286,6 +286,7 @@ class CClientVehicle : public CClientStreamElement int GetWheelFrictionState(unsigned char ucWheel); unsigned char GetPanelStatus(unsigned char ucPanel); unsigned char GetLightStatus(unsigned char ucLight); + SString GetComponentNameForWheel(unsigned char ucWheel) const noexcept; bool AreLightsOn();