Skip to content

Commit

Permalink
Small refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
FileEX committed Aug 12, 2023
1 parent 83599ca commit 9327185
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions Client/mods/deathmatch/logic/CClientVehicle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1466,15 +1466,14 @@ void CClientVehicle::SetWheelStatus(unsigned char ucWheel, unsigned char ucStatu
m_pVehicle->SetWheelVisibility((eWheelPosition)ucWheel, (ucStatus != DT_WHEEL_MISSING));

// restart wheels component visibility (fix #1556)
std::map<SString, SVehicleComponentData>::iterator iter = m_ComponentData.begin();
static SString strComponentName;
static unsigned char ucComponentWheel;

for (; iter != m_ComponentData.end(); iter++)
for (const auto& [key, value] : m_ComponentData)
{
SString strComponentName = (*iter).first;
strComponentName = key;
if (strComponentName.BeginsWith("wheel_"))
{
unsigned char ucComponentWheel;

if (strComponentName == "wheel_lf_dummy")
ucComponentWheel = FRONT_LEFT_WHEEL;
else if (strComponentName == "wheel_rf_dummy")
Expand All @@ -1485,7 +1484,7 @@ void CClientVehicle::SetWheelStatus(unsigned char ucWheel, unsigned char ucStatu
ucComponentWheel = REAR_RIGHT_WHEEL;

if (ucComponentWheel == ucWheel && m_ucWheelStates[ucWheel] != DT_WHEEL_MISSING && ucStatus != DT_WHEEL_MISSING)
SetComponentVisible(strComponentName, (*iter).second.m_bVisible);
SetComponentVisible(strComponentName, value.m_bVisible);
}
}
}
Expand Down

0 comments on commit 9327185

Please sign in to comment.