summaryrefslogtreecommitdiffstats
path: root/src/control/CarCtrl.h
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2019-08-11 19:11:54 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2019-08-11 19:11:54 +0200
commit14b945ba08bfa18d8ac61bb7f5c08b299ce8a2b0 (patch)
tree671d1b9f6f0a3b67449f8d41b28724fe890619b4 /src/control/CarCtrl.h
parentMerge remote-tracking branch 'upstream/master' (diff)
downloadre3-14b945ba08bfa18d8ac61bb7f5c08b299ce8a2b0.tar
re3-14b945ba08bfa18d8ac61bb7f5c08b299ce8a2b0.tar.gz
re3-14b945ba08bfa18d8ac61bb7f5c08b299ce8a2b0.tar.bz2
re3-14b945ba08bfa18d8ac61bb7f5c08b299ce8a2b0.tar.lz
re3-14b945ba08bfa18d8ac61bb7f5c08b299ce8a2b0.tar.xz
re3-14b945ba08bfa18d8ac61bb7f5c08b299ce8a2b0.tar.zst
re3-14b945ba08bfa18d8ac61bb7f5c08b299ce8a2b0.zip
Diffstat (limited to 'src/control/CarCtrl.h')
-rw-r--r--src/control/CarCtrl.h37
1 files changed, 35 insertions, 2 deletions
diff --git a/src/control/CarCtrl.h b/src/control/CarCtrl.h
index 049ae449..735dc89c 100644
--- a/src/control/CarCtrl.h
+++ b/src/control/CarCtrl.h
@@ -1,8 +1,16 @@
#pragma once
+#include "PathFind.h"
+#include "Vehicle.h"
-class CVehicle;
class CZoneInfo;
+enum{
+ MAX_CARS_TO_KEEP = 2,
+ MAX_CAR_MODELS_IN_ARRAY = 256,
+};
+
+#define LANE_WIDTH 5.0f
+
class CCarCtrl
{
enum eCarClass {
@@ -43,6 +51,29 @@ public:
static int32 ChooseModel(CZoneInfo*, CVector*, int*);
static int32 ChoosePoliceCarModel(void);
static int32 ChooseGangCarModel(int32 gang);
+ static void RemoveDistantCars(void);
+ static void PossiblyRemoveVehicle(CVehicle*);
+ static bool IsThisVehicleInteresting(CVehicle*);
+ static int32 CountCarsOfType(int32 mi);
+ static void SlowCarOnRailsDownForTrafficAndLights(CVehicle*);
+ static void PickNextNodeAccordingStrategy(CVehicle*);
+ static void DragCarToPoint(CVehicle*, CVector*);
+ static float FindMaximumSpeedForThisCarInTraffic(CVehicle*);
+ static void SlowCarDownForCarsSectorList(CPtrList&, CVehicle*, float, float, float, float, float*, float);
+ static void SlowCarDownForPedsSectorList(CPtrList&, CVehicle*, float, float, float, float, float*, float);
+
+
+ static float GetOffsetOfLaneFromCenterOfRoad(int8 lane, CCarPathLink* pLink)
+ {
+ return (lane + ((pLink->numLeftLanes == 0) ? (0.5f - 0.5f * pLink->numRightLanes) :
+ ((pLink->numRightLanes == 0) ? (0.5f - 0.5f * pLink->numLeftLanes) : 0.5f))) * LANE_WIDTH;
+ }
+
+ static float GetPositionAlongCurrentCurve(CVehicle* pVehicle)
+ {
+ uint32 timeInCurve = CTimer::GetTimeInMilliseconds() - pVehicle->AutoPilot.m_nTimeEnteredCurve;
+ return (float)timeInCurve / pVehicle->AutoPilot.m_nTimeToSpendOnCurrentCurve;
+ }
static int32 &NumLawEnforcerCars;
static int32 &NumAmbulancesOnDuty;
@@ -57,5 +88,7 @@ public:
static uint32 &LastTimeLawEnforcerCreated;
static int32 (&TotalNumOfCarsOfRating)[7];
static int32 (&NextCarOfRating)[7];
- static int32 (&CarArrays)[7][256];
+ static int32 (&CarArrays)[7][MAX_CAR_MODELS_IN_ARRAY];
};
+
+extern CVehicle* (&apCarsToKeep)[MAX_CARS_TO_KEEP]; \ No newline at end of file