Skip to content

Commit

Permalink
#2920 - Added checks for vehicle occupants
Browse files Browse the repository at this point in the history
  • Loading branch information
TracerDS committed Mar 9, 2023
1 parent 906d1ef commit 5f52432
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Server/mods/deathmatch/logic/CPed.cpp
Expand Up @@ -406,6 +406,9 @@ CVehicle* CPed::SetOccupiedVehicle(CVehicle* pVehicle, unsigned int uiSeat)
static bool bAlreadyIn = false;
if (!bAlreadyIn)
{
if (uiSeat < MAX_VEHICLE_SEATS)
return m_pVehicle;

// Store it
m_pVehicle = pVehicle;
m_uiVehicleSeat = uiSeat;
Expand Down
5 changes: 4 additions & 1 deletion Server/mods/deathmatch/logic/CVehicle.cpp
Expand Up @@ -618,6 +618,9 @@ bool CVehicle::SetOccupant(CPed* pPed, unsigned int uiSeat)
static bool bAlreadySetting = false;
if (!bAlreadySetting)
{
if (uiSeat < MAX_VEHICLE_SEATS)
return false;

// Set the Player
if (m_pOccupants[uiSeat] != pPed)
{
Expand All @@ -644,7 +647,7 @@ bool CVehicle::SetOccupant(CPed* pPed, unsigned int uiSeat)
return true;
}

return true;
return true; // return true? even if function didn't end successfully?
}

void CVehicle::SetSyncer(CPlayer* pPlayer)
Expand Down

0 comments on commit 5f52432

Please sign in to comment.