Skip to content

Commit

Permalink
attempt to fix vehicle release in events called in vehicle sync
Browse files Browse the repository at this point in the history
  • Loading branch information
AmyrAhmady committed Sep 17, 2024
1 parent c0df2d9 commit a9f4c2a
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 a9f4c2a

Please sign in to comment.