From 4d2a9e384ccb83eec9992ad36459f495bfcfe60f Mon Sep 17 00:00:00 2001 From: michi_cc Date: Mon, 21 Nov 2011 20:51:43 +0000 Subject: (svn r23290) -Fix [FS#2379,FS#3569]: Change the centre of train vehicles to depend on the vehicle length instead of being fixed at 4/8th of the original vehicle length to make sure shortened vehicles don't block tiles they shouldn't block. --- src/rail_cmd.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/rail_cmd.cpp') 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 -- cgit v1.2.3-54-g00ecf