summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--game/vehicles/train.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/game/vehicles/train.cpp b/game/vehicles/train.cpp
index 5bddd61..2461d9c 100644
--- a/game/vehicles/train.cpp
+++ b/game/vehicles/train.cpp
@@ -2,7 +2,6 @@
#include "game/vehicles/linkHistory.h"
#include "game/vehicles/railVehicle.h"
#include "game/vehicles/railVehicleClass.h"
-#include "gfx/renderable.h"
#include "location.h"
#include <algorithm>
#include <functional>
@@ -11,6 +10,9 @@
template<typename> class Ray;
+constexpr auto DECELERATION_RATE = 60000.F;
+constexpr auto ACCELERATIONS_RATE = 30000.F;
+
Location
Train::getBogiePosition(float linkDist, float dist) const
{
@@ -41,8 +43,8 @@ Train::doActivity(Go * go, TickDuration dur)
const auto maxSpeed = objects.front()->rvClass->maxSpeed;
if (go->dist) {
*go->dist -= speed * dur.count();
- if (*go->dist < (speed * speed) / 60.F) {
- speed -= std::min(speed, 30.F * dur.count());
+ if (*go->dist < (speed * speed) / DECELERATION_RATE) {
+ speed -= std::min(speed, ACCELERATIONS_RATE * dur.count());
}
else {
if (speed != maxSpeed) {
@@ -61,6 +63,6 @@ void
Train::doActivity(Idle *, TickDuration dur)
{
if (speed != 0.F) {
- speed -= std::min(speed, 30.F * dur.count());
+ speed -= std::min(speed, DECELERATION_RATE * dur.count());
}
}