Skip to content

Commit

Permalink
Fix multitheftauto#578: doors state with setElementModel (multithefta…
Browse files Browse the repository at this point in the history
…uto#599)

Changing vehicle model from doorless or "doorful" causes doors to fall off.

1. Take a tractor.
2. Set its model to a 4 door vehicle.
3. Doors fall off.

From bugs.mtasa.com/view.php?id=9915
  • Loading branch information
FileEX committed Mar 23, 2020
1 parent 2429683 commit c2dc463
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 52 deletions.
31 changes: 5 additions & 26 deletions Client/mods/deathmatch/logic/CClientVehicle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3598,32 +3598,11 @@ void CClientVehicle::Interpolate()

void CClientVehicle::GetInitialDoorStates(SFixedArray<unsigned char, MAX_DOORS>& ucOutDoorStates)
{
switch (m_usModel)
{
case VT_BAGGAGE:
case VT_BANDITO:
case VT_BFINJECT:
case VT_CADDY:
case VT_DOZER:
case VT_FORKLIFT:
case VT_KART:
case VT_MOWER:
case VT_QUAD:
case VT_RCBANDIT:
case VT_RCCAM:
case VT_RCGOBLIN:
case VT_RCRAIDER:
case VT_RCTIGER:
case VT_TRACTOR:
case VT_VORTEX:
memset(&ucOutDoorStates[0], DT_DOOR_MISSING, MAX_DOORS);

// Keep the bonet and boot intact
ucOutDoorStates[0] = ucOutDoorStates[1] = DT_DOOR_INTACT;
break;
default:
memset(&ucOutDoorStates[0], DT_DOOR_INTACT, MAX_DOORS);
}
memset(&ucOutDoorStates[0], DT_DOOR_INTACT, MAX_DOORS);

// Keep the bonet and boot intact
ucOutDoorStates[0] = ucOutDoorStates[1] = DT_DOOR_INTACT;
memset(&ucOutDoorStates[0], DT_DOOR_INTACT, MAX_DOORS);
}

void CClientVehicle::SetTargetPosition(const CVector& vecTargetPosition, unsigned long ulDelay, bool bValidVelocityZ, float fVelocityZ)
Expand Down
31 changes: 5 additions & 26 deletions Server/mods/deathmatch/logic/CVehicle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -777,32 +777,11 @@ void CVehicle::SetPaintjob(unsigned char ucPaintjob)

void CVehicle::GetInitialDoorStates(SFixedArray<unsigned char, MAX_DOORS>& ucOutDoorStates)
{
switch (m_usModel)
{
case VT_BAGGAGE:
case VT_BANDITO:
case VT_BFINJECT:
case VT_CADDY:
case VT_DOZER:
case VT_FORKLIFT:
case VT_KART:
case VT_MOWER:
case VT_QUAD:
case VT_RCBANDIT:
case VT_RCCAM:
case VT_RCGOBLIN:
case VT_RCRAIDER:
case VT_RCTIGER:
case VT_TRACTOR:
case VT_VORTEX:
memset(&ucOutDoorStates[0], DT_DOOR_MISSING, MAX_DOORS);

// Keep the bonet and boot intact
ucOutDoorStates[0] = ucOutDoorStates[1] = DT_DOOR_INTACT;
break;
default:
memset(&ucOutDoorStates[0], DT_DOOR_INTACT, MAX_DOORS);
}
memset(&ucOutDoorStates[0], DT_DOOR_INTACT, MAX_DOORS);

// Keep the bonet and boot intact
ucOutDoorStates[0] = ucOutDoorStates[1] = DT_DOOR_INTACT;
memset(&ucOutDoorStates[0], DT_DOOR_INTACT, MAX_DOORS);
}

void CVehicle::GenerateHandlingData()
Expand Down

0 comments on commit c2dc463

Please sign in to comment.