summaryrefslogtreecommitdiffstats
path: root/src/vehicles/Transmission.cpp
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2019-07-17 13:19:20 +0200
committeraap <aap@papnet.eu>2019-07-17 13:19:20 +0200
commit0f1fbf5e9a7477c6fbb7645491598e87ed2e183e (patch)
tree713a8e10b3657d4c3a0d9c20c3704e0da8f9357e /src/vehicles/Transmission.cpp
parentMerge pull request #139 from Nick007J/master (diff)
downloadre3-0f1fbf5e9a7477c6fbb7645491598e87ed2e183e.tar
re3-0f1fbf5e9a7477c6fbb7645491598e87ed2e183e.tar.gz
re3-0f1fbf5e9a7477c6fbb7645491598e87ed2e183e.tar.bz2
re3-0f1fbf5e9a7477c6fbb7645491598e87ed2e183e.tar.lz
re3-0f1fbf5e9a7477c6fbb7645491598e87ed2e183e.tar.xz
re3-0f1fbf5e9a7477c6fbb7645491598e87ed2e183e.tar.zst
re3-0f1fbf5e9a7477c6fbb7645491598e87ed2e183e.zip
Diffstat (limited to '')
-rw-r--r--src/vehicles/Transmission.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/vehicles/Transmission.cpp b/src/vehicles/Transmission.cpp
index 2be25cbb..f8c345f1 100644
--- a/src/vehicles/Transmission.cpp
+++ b/src/vehicles/Transmission.cpp
@@ -35,3 +35,18 @@ cTransmission::InitGearRatios(void)
Gears[1].fShiftDownVelocity = -0.01f;
}
+
+void
+cTransmission::CalculateGearForSimpleCar(float speed, uint8 &gear)
+{
+ static tGear *pGearRatio = &Gears[gear];
+ fCurVelocity = speed;
+ if(speed > pGearRatio->fShiftUpVelocity)
+ gear++;
+ else if(speed < pGearRatio->fShiftDownVelocity){
+ if(gear - 1 < 0)
+ gear = 0;
+ else
+ gear--;
+ }
+}