(svn r23164) -Fix (r23149): Default roadvehicles became somewhat short.

This commit is contained in:
frosch 2011-11-08 18:21:56 +00:00
parent ed04410f89
commit 186694369d
1 changed files with 3 additions and 2 deletions

View File

@ -163,7 +163,7 @@ void DrawRoadVehEngine(int left, int right, int preferred_x, int y, EngineID eng
static uint GetRoadVehLength(const RoadVehicle *v)
{
const Engine *e = v->GetEngine();
uint length = e->u.road.shorten_factor;
uint length = VEHICLE_LENGTH;
uint16 veh_len = CALLBACK_FAILED;
if (e->GetGRF() != NULL && e->GetGRF()->grf_version >= 8) {
@ -173,7 +173,8 @@ static uint GetRoadVehLength(const RoadVehicle *v)
/* Use callback 11 */
veh_len = GetVehicleCallback(CBID_VEHICLE_LENGTH, 0, 0, v->engine_type, v);
}
if (veh_len != CALLBACK_FAILED) {
if (veh_len == CALLBACK_FAILED) veh_len = e->u.road.shorten_factor;
if (veh_len != 0) {
if (veh_len >= VEHICLE_LENGTH) ErrorUnknownCallbackResult(e->GetGRFID(), CBID_VEHICLE_LENGTH, veh_len);
length -= Clamp(veh_len, 0, VEHICLE_LENGTH - 1);
}