(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.

This commit is contained in:
michi_cc
2011-11-21 20:51:43 +00:00
parent 3748cab608
commit 4d2a9e384c
10 changed files with 230 additions and 59 deletions

View File

@@ -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