diff options
Diffstat (limited to 'src/train_cmd.cpp')
-rw-r--r-- | src/train_cmd.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index bc7898667..94921a3eb 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -221,12 +221,15 @@ void Train::ConsistChanged(bool same_length) /* check the vehicle length (callback) */ uint16 veh_len = CALLBACK_FAILED; - if (HasBit(e_u->info.callback_mask, CBM_VEHICLE_LENGTH)) { + if (e_u->GetGRF() != NULL && e_u->GetGRF()->grf_version >= 8) { + /* Use callback 36 */ + veh_len = GetVehicleProperty(u, PROP_TRAIN_SHORTEN_FACTOR, CALLBACK_FAILED); + } else if (HasBit(e_u->info.callback_mask, CBM_VEHICLE_LENGTH)) { + /* Use callback 11 */ veh_len = GetVehicleCallback(CBID_VEHICLE_LENGTH, 0, 0, u->engine_type, u); - - if (veh_len != CALLBACK_FAILED && veh_len >= VEHICLE_LENGTH) { - ErrorUnknownCallbackResult(e_u->GetGRFID(), CBID_VEHICLE_LENGTH, veh_len); - } + } + if (veh_len != CALLBACK_FAILED && veh_len >= VEHICLE_LENGTH) { + ErrorUnknownCallbackResult(e_u->GetGRFID(), CBID_VEHICLE_LENGTH, veh_len); } if (veh_len == CALLBACK_FAILED) veh_len = rvi_u->shorten_factor; veh_len = VEHICLE_LENGTH - Clamp(veh_len, 0, VEHICLE_LENGTH - 1); |