little fix

This commit is contained in:
Nikolay Korolev 2020-08-18 20:08:27 +03:00
parent 4ffa585cce
commit c559b71bc9

View file

@ -13363,7 +13363,7 @@ CPed::ProcessObjective(void)
if (m_pMyVehicle) { if (m_pMyVehicle) {
m_pMyVehicle->AutoPilot.m_nCruiseSpeed = 0; m_pMyVehicle->AutoPilot.m_nCruiseSpeed = 0;
} else { } else {
float closestVehDist = 3600.0f; float closestVehDist = SQR(60.0f);
int16 lastVehicle; int16 lastVehicle;
CEntity* vehicles[8]; CEntity* vehicles[8];
CWorld::FindObjectsInRange(GetPosition(), 25.0f, true, &lastVehicle, 6, vehicles, false, true, false, false, false); CWorld::FindObjectsInRange(GetPosition(), 25.0f, true, &lastVehicle, 6, vehicles, false, true, false, false, false);
@ -13376,11 +13376,11 @@ CPed::ProcessObjective(void)
CVector ourSpeed = GetSpeed(); CVector ourSpeed = GetSpeed();
*/ */
CVector vehDistVec = nearVeh->GetPosition() - GetPosition(); CVector vehDistVec = nearVeh->GetPosition() - GetPosition();
if (vehDistVec.Magnitude() < closestVehDist if (vehDistVec.MagnitudeSqr() < closestVehDist
&& m_pedInObjective->m_pMyVehicle != nearVeh) && m_pedInObjective->m_pMyVehicle != nearVeh)
{ {
foundVeh = nearVeh; foundVeh = nearVeh;
closestVehDist = vehDistVec.Magnitude(); closestVehDist = vehDistVec.MagnitudeSqr();
} }
} }
m_pMyVehicle = foundVeh; m_pMyVehicle = foundVeh;