summaryrefslogtreecommitdiff
path: root/src/vehicles/Transmission.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/vehicles/Transmission.cpp')
-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--;
+ }
+}