summaryrefslogtreecommitdiff
path: root/src/rail_cmd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/rail_cmd.cpp')
-rw-r--r--src/rail_cmd.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp
index 6196d78af..ed0362935 100644
--- a/src/rail_cmd.cpp
+++ b/src/rail_cmd.cpp
@@ -2711,7 +2711,7 @@ static const int8 _deltacoord_leaveoffset[8] = {
int TicksToLeaveDepot(const Train *v)
{
DiagDirection dir = GetRailDepotDirection(v->tile);
- int length = v->gcache.cached_veh_length;
+ int length = v->CalcNextVehicleOffset();
switch (dir) {
case DIAGDIR_NE: return ((int)(v->x_pos & 0x0F) - ((_fractcoords_enter[dir] & 0x0F) - (length + 1)));
@@ -2738,9 +2738,8 @@ static VehicleEnterTileStatus VehicleEnter_Track(Vehicle *u, TileIndex tile, int
/* depot direction */
DiagDirection dir = GetRailDepotDirection(tile);
- /* calculate the point where the following wagon should be activated
- * this depends on the length of the current vehicle */
- int length = v->gcache.cached_veh_length;
+ /* Calculate the point where the following wagon should be activated. */
+ int length = v->CalcNextVehicleOffset();
byte fract_coord_leave =
((_fractcoords_enter[dir] & 0x0F) + // x