summaryrefslogtreecommitdiffstats
path: root/src/vehicles
diff options
context:
space:
mode:
authorFire_Head <Fire-Head@users.noreply.github.com>2019-07-24 19:59:16 +0200
committerGitHub <noreply@github.com>2019-07-24 19:59:16 +0200
commitb79f77634dbb33627c390243d7cf2e7611d35d0a (patch)
treed836f70678f2ce7b5d86a6745f34b45232ff71d0 /src/vehicles
parentimplemented cBuoyancy (diff)
parentupdate (diff)
downloadre3-b79f77634dbb33627c390243d7cf2e7611d35d0a.tar
re3-b79f77634dbb33627c390243d7cf2e7611d35d0a.tar.gz
re3-b79f77634dbb33627c390243d7cf2e7611d35d0a.tar.bz2
re3-b79f77634dbb33627c390243d7cf2e7611d35d0a.tar.lz
re3-b79f77634dbb33627c390243d7cf2e7611d35d0a.tar.xz
re3-b79f77634dbb33627c390243d7cf2e7611d35d0a.tar.zst
re3-b79f77634dbb33627c390243d7cf2e7611d35d0a.zip
Diffstat (limited to 'src/vehicles')
-rw-r--r--src/vehicles/Boat.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/vehicles/Boat.cpp b/src/vehicles/Boat.cpp
index 53a912b3..c18bad25 100644
--- a/src/vehicles/Boat.cpp
+++ b/src/vehicles/Boat.cpp
@@ -37,8 +37,8 @@ bool CBoat::IsSectorAffectedByWake(CVector2D sector, float fSize, CBoat **apBoat
{
float fDist = (WAKE_LIFETIME - pBoat->m_afWakePointLifeTime[j]) * fShapeTime + float(j) * fShapeLength + fSize;
- if ( fabs(pBoat->m_avec2dWakePoints[j].x - sector.x) < fDist
- && fabs(pBoat->m_avec2dWakePoints[i].y - sector.y) < fDist )
+ if ( Abs(pBoat->m_avec2dWakePoints[j].x - sector.x) < fDist
+ && Abs(pBoat->m_avec2dWakePoints[i].y - sector.y) < fDist )
{
apBoats[numVerts] = pBoat;
numVerts = 1; // += ?
@@ -56,13 +56,12 @@ float CBoat::IsVertexAffectedByWake(CVector vecVertex, CBoat *pBoat)
{
float fMaxDist = (WAKE_LIFETIME - pBoat->m_afWakePointLifeTime[i]) * fShapeTime + float(i) * fShapeLength;
- float fX = pBoat->m_avec2dWakePoints[i].x - vecVertex.x;
- float fY = pBoat->m_avec2dWakePoints[i].y - vecVertex.y;
+ CVector2D vecDist = pBoat->m_avec2dWakePoints[i] - CVector2D(vecVertex);
- float fDist = fY * fY + fX * fX;
+ float fDist = vecDist.MagnitudeSqr();
if ( fDist < SQR(fMaxDist) )
- return 1.0f - min(fRangeMult * sqrt(fDist / SQR(fMaxDist)) + (WAKE_LIFETIME - pBoat->m_afWakePointLifeTime[i]) * fTimeMult, 1.0f);
+ return 1.0f - min(fRangeMult * Sqrt(fDist / SQR(fMaxDist)) + (WAKE_LIFETIME - pBoat->m_afWakePointLifeTime[i]) * fTimeMult, 1.0f);
}
return 0.0f;