From 93be7633012c569bf6d97c345c074b28502331b2 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Sun, 27 Jun 2021 22:12:29 +0100 Subject: [PATCH] Update ticks per tile constant --- src/train_cmd.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 490f3e9f42..a06a6a1bd4 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -102,9 +102,8 @@ static DateTicksScaled GetSpeedRestrictionTimeout(const Train *t) const int64 look_ahead_distance = 16; // In tiles const int64 velocity = std::max(25, t->cur_speed); - // This is a guess. I cannot figure out how the game actually calculates ticks_per_tile. - // If anybody has the correct value here, let me know. - const int64 ticks_per_tile = 2232 / velocity; + // This assumes travel along the X or Y map axis, not diagonally. See GetAdvanceDistance, GetAdvanceSpeed. + const int64 ticks_per_tile = (192 * 16 * 4 / 3) / velocity; const int64 ticks = ticks_per_tile * look_ahead_distance;