summaryrefslogtreecommitdiffstats
path: root/src/control/Garages.cpp
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2020-04-05 11:03:13 +0200
committerSergeanur <s.anureev@yandex.ua>2020-04-05 11:03:13 +0200
commit2aace31b06c65dd9e4b58280cc64eaa5cd58eaf4 (patch)
tree661507c1a29d128122a6c7125aa09f00f45c9b1c /src/control/Garages.cpp
parentJapanese (diff)
parentMerge pull request #377 from Fire-Head/master (diff)
downloadre3-2aace31b06c65dd9e4b58280cc64eaa5cd58eaf4.tar
re3-2aace31b06c65dd9e4b58280cc64eaa5cd58eaf4.tar.gz
re3-2aace31b06c65dd9e4b58280cc64eaa5cd58eaf4.tar.bz2
re3-2aace31b06c65dd9e4b58280cc64eaa5cd58eaf4.tar.lz
re3-2aace31b06c65dd9e4b58280cc64eaa5cd58eaf4.tar.xz
re3-2aace31b06c65dd9e4b58280cc64eaa5cd58eaf4.tar.zst
re3-2aace31b06c65dd9e4b58280cc64eaa5cd58eaf4.zip
Diffstat (limited to 'src/control/Garages.cpp')
-rw-r--r--src/control/Garages.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp
index c36ecadb..2cb89444 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()