Skip to content

Commit 5dd446b

Browse files
saml1ercodenulls
andauthored
Fix #863 warpPedIntoVehicle fails when there are too many vehicles streamed in (#1431)
* Fix #863 warpPedIntoVehicle fails when there are too many vehicles streamed in * Fix typo: wrap to warp (thanks ZeoN) Co-authored-by: saml1er <[email protected]>
1 parent 190a262 commit 5dd446b

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

Client/mods/deathmatch/logic/CClientGame.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1793,7 +1793,7 @@ void CClientGame::UpdateVehicleInOut()
17931793
}
17941794

17951795
// Are we supposed to be in a vehicle? But aren't?
1796-
if (pOccupiedVehicle && !pVehicle)
1796+
if (pOccupiedVehicle && !pVehicle && !m_pLocalPlayer->IsWarpInToVehicleRequired())
17971797
{
17981798
// Jax: this happens when we try to warp into a streamed out vehicle, including when we use CClientVehicle::StreamInNow
17991799
// ..maybe we need a different way to detect bike falls?

Client/mods/deathmatch/logic/CClientPed.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,6 +1347,8 @@ void CClientPed::GetIntoVehicle(CClientVehicle* pVehicle, unsigned int uiSeat, u
13471347

13481348
void CClientPed::WarpIntoVehicle(CClientVehicle* pVehicle, unsigned int uiSeat)
13491349
{
1350+
SetWarpInToVehicleRequired(true);
1351+
13501352
// Ensure vehicle model is loaded
13511353
CModelInfo* pModelInfo = pVehicle->GetModelInfo();
13521354
if (g_pGame->IsASyncLoadingEnabled() && !pModelInfo->IsLoaded())
@@ -4165,6 +4167,7 @@ void CClientPed::InternalWarpIntoVehicle(CVehicle* pGameVehicle)
41654167
pInTask->SetIsWarpingPedIntoCar();
41664168
pInTask->ProcessPed(m_pPlayerPed);
41674169
pInTask->Destroy();
4170+
SetWarpInToVehicleRequired(false);
41684171
}
41694172

41704173
// If we're a remote player
@@ -4180,6 +4183,8 @@ void CClientPed::InternalRemoveFromVehicle(CVehicle* pGameVehicle)
41804183
{
41814184
if (m_pPlayerPed && m_pTaskManager)
41824185
{
4186+
SetWarpInToVehicleRequired(false);
4187+
41834188
// Reset whatever task
41844189
m_pTaskManager->RemoveTask(TASK_PRIORITY_PRIMARY);
41854190

Client/mods/deathmatch/logic/CClientPed.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,9 @@ class CClientPed : public CClientStreamElement, public CAntiCheatModule
569569
void SetTaskTypeToBeRestoredOnAnimEnd(eTaskType taskType) { m_eTaskTypeToBeRestoredOnAnimEnd = taskType; }
570570
eTaskType GetTaskTypeToBeRestoredOnAnimEnd() { return m_eTaskTypeToBeRestoredOnAnimEnd; }
571571

572+
bool IsWarpInToVehicleRequired() { return m_bWarpInToVehicleRequired; }
573+
void SetWarpInToVehicleRequired(bool warp) { m_bWarpInToVehicleRequired = warp; }
574+
572575
void NotifyCreate();
573576
void NotifyDestroy();
574577

@@ -733,4 +736,5 @@ class CClientPed : public CClientStreamElement, public CAntiCheatModule
733736
ReplacedAnim_type m_mapOfReplacedAnimations;
734737
bool m_bTaskToBeRestoredOnAnimEnd;
735738
eTaskType m_eTaskTypeToBeRestoredOnAnimEnd;
739+
bool m_bWarpInToVehicleRequired = false;
736740
};

0 commit comments

Comments
 (0)