diff options
author | michi_cc <michi_cc@openttd.org> | 2011-11-21 20:51:43 +0000 |
---|---|---|
committer | michi_cc <michi_cc@openttd.org> | 2011-11-21 20:51:43 +0000 |
commit | 4d2a9e384ccb83eec9992ad36459f495bfcfe60f (patch) | |
tree | 26d51a4b166e5dfeff2c1e2bbe753b73df80332b /src/rail_cmd.cpp | |
parent | 3748cab60876e98e530c514307e303a071498461 (diff) | |
download | openttd-4d2a9e384ccb83eec9992ad36459f495bfcfe60f.tar.xz |
(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.
Diffstat (limited to 'src/rail_cmd.cpp')
-rw-r--r-- | src/rail_cmd.cpp | 7 |
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 |