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/vehicle.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/vehicle.cpp')
-rw-r--r-- | src/vehicle.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 69c40975b..4d16fc3a7 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -962,7 +962,7 @@ static void DoDrawVehicle(const Vehicle *v) } AddSortableSpriteToDraw(image, pal, v->x_pos + v->x_offs, v->y_pos + v->y_offs, - v->x_extent, v->y_extent, v->z_extent, v->z_pos, shadowed); + v->x_extent, v->y_extent, v->z_extent, v->z_pos, shadowed, v->x_bb_offs, v->y_bb_offs); } /** @@ -2213,6 +2213,11 @@ void Vehicle::ShowVisualEffect() const continue; } + /* The effect offset is relative to a point 4 units behind the vehicle's + * front (which is the center of an 8/8 vehicle). Shorter vehicles need a + * correction factor. */ + if (v->type == VEH_TRAIN) effect_offset += (VEHICLE_LENGTH - Train::From(v)->gcache.cached_veh_length) / 2; + int x = _vehicle_smoke_pos[v->direction] * effect_offset; int y = _vehicle_smoke_pos[(v->direction + 2) % 8] * effect_offset; |