Skip to content

Commit

Permalink
Fix doors
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNormalnij committed Oct 3, 2024
1 parent 4f5aae1 commit ae60251
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions Client/game_sa/CVehicleSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ void CVehicleSA::Init()
SetColor(m_RGBColors[0], m_RGBColors[1], m_RGBColors[2], m_RGBColors[3], 0);

// Initialize doors depending on the vehicle type.
DWORD dwOffset = 0;
std::uint32_t doorArrayOffset;

switch (static_cast<VehicleClass>(GetVehicleInterface()->m_vehicleClass))
{
Expand All @@ -177,22 +177,25 @@ void CVehicleSA::Init()
case VehicleClass::PLANE:
case VehicleClass::TRAILER:
{
dwOffset = 1464;
doorArrayOffset = 1464;
break;
}
case VehicleClass::TRAIN:
{
dwOffset = 1496;
doorArrayOffset = 1496;
break;
}
default:
doorArrayOffset = 0;
break;
}

if (dwOffset != 0)
if (doorArrayOffset != 0)
{
for (unsigned int i = 0; i < sizeof(m_doors) / sizeof(m_doors[0]); ++i)
for (std::uint32_t i = 0; i < sizeof(m_doors) / sizeof(m_doors[0]); ++i)
{
DWORD dwInterface = (DWORD)GetInterface();
DWORD dwDoorAddress = dwInterface + dwOffset + i * 24;
std::uint32_t dwInterface = (std::uint32_t)GetInterface();
std::uint32_t dwDoorAddress = dwInterface + doorArrayOffset + i * 24;
m_doors[i].SetInterface((CDoorSAInterface*)dwDoorAddress);
}
}
Expand Down

0 comments on commit ae60251

Please sign in to comment.