summaryrefslogtreecommitdiffstats
path: root/src/control/CarCtrl.cpp
diff options
context:
space:
mode:
authorFilip Gawin <filip.gawin@zoho.com>2019-08-16 20:17:15 +0200
committerFilip Gawin <filip.gawin@zoho.com>2019-08-27 21:18:47 +0200
commit2fabbc3b4cab40220986f402569af64673cb4cd9 (patch)
tree3278631a5e3dd19a0af92204e6bfb48702dd04f0 /src/control/CarCtrl.cpp
parentCleanup (diff)
downloadre3-2fabbc3b4cab40220986f402569af64673cb4cd9.tar
re3-2fabbc3b4cab40220986f402569af64673cb4cd9.tar.gz
re3-2fabbc3b4cab40220986f402569af64673cb4cd9.tar.bz2
re3-2fabbc3b4cab40220986f402569af64673cb4cd9.tar.lz
re3-2fabbc3b4cab40220986f402569af64673cb4cd9.tar.xz
re3-2fabbc3b4cab40220986f402569af64673cb4cd9.tar.zst
re3-2fabbc3b4cab40220986f402569af64673cb4cd9.zip
Diffstat (limited to '')
-rw-r--r--src/control/CarCtrl.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp
index bcf94479..677436a6 100644
--- a/src/control/CarCtrl.cpp
+++ b/src/control/CarCtrl.cpp
@@ -340,7 +340,7 @@ CCarCtrl::GenerateOneRandomCar()
if (distanceBetweenNodes / 2 < carLength)
positionBetweenNodes = 0.5f;
else
- positionBetweenNodes = min(1.0f - carLength / distanceBetweenNodes, max(carLength / distanceBetweenNodes, positionBetweenNodes));
+ positionBetweenNodes = Min(1.0f - carLength / distanceBetweenNodes, Max(carLength / distanceBetweenNodes, positionBetweenNodes));
pCar->AutoPilot.m_nNextDirection = (curNodeId >= nextNodeId) ? 1 : -1;
if (pCurNode->numLinks == 1){
/* Do not create vehicle if there is nowhere to go. */
@@ -793,10 +793,10 @@ CCarCtrl::FindMaximumSpeedForThisCarInTraffic(CVehicle* pVehicle)
float right = pVehicle->GetPosition().x + DISTANCE_TO_SCAN_FOR_DANGER;
float top = pVehicle->GetPosition().y - DISTANCE_TO_SCAN_FOR_DANGER;
float bottom = pVehicle->GetPosition().y + DISTANCE_TO_SCAN_FOR_DANGER;
- int xstart = max(0, CWorld::GetSectorIndexX(left));
- int xend = min(NUMSECTORS_X - 1, CWorld::GetSectorIndexX(right));
- int ystart = max(0, CWorld::GetSectorIndexY(top));
- int yend = min(NUMSECTORS_Y - 1, CWorld::GetSectorIndexY(bottom));
+ int xstart = Max(0, CWorld::GetSectorIndexX(left));
+ int xend = Min(NUMSECTORS_X - 1, CWorld::GetSectorIndexX(right));
+ int ystart = Max(0, CWorld::GetSectorIndexY(top));
+ int yend = Min(NUMSECTORS_Y - 1, CWorld::GetSectorIndexY(bottom));
assert(xstart <= xend);
assert(ystart <= yend);
@@ -827,10 +827,10 @@ CCarCtrl::ScanForPedDanger(CVehicle* pVehicle)
float right = pVehicle->GetPosition().x + DISTANCE_TO_SCAN_FOR_DANGER;
float top = pVehicle->GetPosition().y - DISTANCE_TO_SCAN_FOR_DANGER;
float bottom = pVehicle->GetPosition().y + DISTANCE_TO_SCAN_FOR_DANGER;
- int xstart = max(0, CWorld::GetSectorIndexX(left));
- int xend = min(NUMSECTORS_X - 1, CWorld::GetSectorIndexX(right));
- int ystart = max(0, CWorld::GetSectorIndexY(top));
- int yend = min(NUMSECTORS_Y - 1, CWorld::GetSectorIndexY(bottom));
+ int xstart = Max(0, CWorld::GetSectorIndexX(left));
+ int xend = Min(NUMSECTORS_X - 1, CWorld::GetSectorIndexX(right));
+ int ystart = Max(0, CWorld::GetSectorIndexY(top));
+ int yend = Min(NUMSECTORS_Y - 1, CWorld::GetSectorIndexY(bottom));
assert(xstart <= xend);
assert(ystart <= yend);
@@ -862,12 +862,12 @@ CCarCtrl::SlowCarOnRailsDownForTrafficAndLights(CVehicle* pVehicle)
float curSpeed = pVehicle->AutoPilot.m_fMaxTrafficSpeed;
if (maxSpeed >= curSpeed){
if (maxSpeed > curSpeed)
- pVehicle->AutoPilot.ModifySpeed(min(maxSpeed, curSpeed + 0.05f * CTimer::GetTimeStep()));
+ pVehicle->AutoPilot.ModifySpeed(Min(maxSpeed, curSpeed + 0.05f * CTimer::GetTimeStep()));
}else{
if (curSpeed == 0.0f)
return;
if (curSpeed >= 0.1f)
- pVehicle->AutoPilot.ModifySpeed(max(maxSpeed, curSpeed - 0.5f * CTimer::GetTimeStep()));
+ pVehicle->AutoPilot.ModifySpeed(Max(maxSpeed, curSpeed - 0.5f * CTimer::GetTimeStep()));
else if (curSpeed != 0.0f) /* no need to check */
pVehicle->AutoPilot.ModifySpeed(0.0f);
}