diff options
author | Nikolay Korolev <nickvnuk@gmail.com> | 2020-04-01 00:58:40 +0200 |
---|---|---|
committer | Nikolay Korolev <nickvnuk@gmail.com> | 2020-04-01 00:58:40 +0200 |
commit | 347f0a0e9c687a198ba7fd0ead67a2d63b7880f2 (patch) | |
tree | fbaa58157ecb3a29efe8634a14bb3a6ecd1da3c2 /src/control/Garages.cpp | |
parent | review fixes (diff) | |
download | re3-347f0a0e9c687a198ba7fd0ead67a2d63b7880f2.tar re3-347f0a0e9c687a198ba7fd0ead67a2d63b7880f2.tar.gz re3-347f0a0e9c687a198ba7fd0ead67a2d63b7880f2.tar.bz2 re3-347f0a0e9c687a198ba7fd0ead67a2d63b7880f2.tar.lz re3-347f0a0e9c687a198ba7fd0ead67a2d63b7880f2.tar.xz re3-347f0a0e9c687a198ba7fd0ead67a2d63b7880f2.tar.zst re3-347f0a0e9c687a198ba7fd0ead67a2d63b7880f2.zip |
Diffstat (limited to 'src/control/Garages.cpp')
-rw-r--r-- | src/control/Garages.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp index 93857b14..68d58b10 100644 --- a/src/control/Garages.cpp +++ b/src/control/Garages.cpp @@ -2078,14 +2078,12 @@ void CGarage::CenterCarInGarage(CVehicle* pVehicle) return; if (IsAnyOtherPedTouchingGarage(FindPlayerPed())) return; - float posX = pVehicle->GetPosition().x; - float posY = pVehicle->GetPosition().y; - float posZ = pVehicle->GetPosition().z; + CVector pos = pVehicle->GetPosition(); float garageX = GetGarageCenterX(); float garageY = GetGarageCenterY(); - float offsetX = garageX - posX; - float offsetY = garageY - posY; - float offsetZ = posZ - posZ; + float offsetX = garageX - pos.x; + float offsetY = garageY - pos.y; + float offsetZ = pos.z - pos.z; float distance = CVector(offsetX, offsetY, offsetZ).Magnitude(); if (distance < RESPRAY_CENTERING_COEFFICIENT) { pVehicle->GetPosition().x = GetGarageCenterX(); @@ -2096,7 +2094,7 @@ void CGarage::CenterCarInGarage(CVehicle* pVehicle) pVehicle->GetPosition().y += offsetY * RESPRAY_CENTERING_COEFFICIENT / distance; } if (!IsEntityEntirelyInside3D(pVehicle, 0.1f)) - pVehicle->GetPosition() = CVector(posX, posY, posZ); + pVehicle->GetPosition() = pos; } void CGarages::CloseHideOutGaragesBeforeSave() |