Skip to content

Commit

Permalink
Merge pull request #983 from openmultiplayer/amir/fix-vehicle-release
Browse files Browse the repository at this point in the history
fix vehicle release in events called in driver sync
  • Loading branch information
AmyrAhmady authored Sep 17, 2024
2 parents c0df2d9 + a9f4c2a commit 14c7971
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Server/Source/player_pool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,9 @@ struct PlayerPool final : public IPlayerPool, public NetworkEventHandler, public
return false;
}

IVehicle& vehicle = *vehiclePtr;
ScopedPoolReleaseLock lock(*self.vehiclesComponent, *vehiclePtr);
IVehicle& vehicle = *lock.entry;

Player& player = static_cast<Player&>(peer);
player.pos_ = vehicleSync.Position;
player.health_ = vehicleSync.PlayerHealthArmour.x;
Expand Down Expand Up @@ -1379,7 +1381,8 @@ struct PlayerPool final : public IPlayerPool, public NetworkEventHandler, public
return false;
}

IVehicle& vehicle = *vehiclePtr;
ScopedPoolReleaseLock lock(*self.vehiclesComponent, *vehiclePtr);
IVehicle& vehicle = *lock.entry;
Player& player = static_cast<Player&>(peer);

if (vehicle.isRespawning())
Expand Down

0 comments on commit 14c7971

Please sign in to comment.