(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

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