This looks interesting. However, on reviewing the code, I note that it deletes code without replacement that was implemented as a fix to a reported bug in 2015 with the commit message:
FIX: Trains would not advance their schedules properly in stations in some cases
(See commit no. 03ea2e9492ebd927076c2ce44a6e4294dbdb788a of the 6th of September 2015).
I am concerned that, if I integrate this, this will cause the bug reported that lead to this fix to recur. To integrate this, we will need to find the original bug report, test that this behaviour does not occur with the current master branch version, apply this patch, and test whether this behaviour occurs with this patch applied.