diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/roadveh_cmd.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp index e48cbb349..3fe5ce84e 100644 --- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -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); } |