@@ -166,19 +166,19 @@ static uint GetRoadVehLength(const RoadV
uint length = VEHICLE_LENGTH;
uint16 veh_len = CALLBACK_FAILED;
if (e->GetGRF() != NULL && e->GetGRF()->grf_version >= 8) {
/* Use callback 36 */
veh_len = GetVehicleProperty(v, PROP_ROADVEH_SHORTEN_FACTOR, CALLBACK_FAILED);
if (veh_len != CALLBACK_FAILED && veh_len >= VEHICLE_LENGTH) ErrorUnknownCallbackResult(e->GetGRFID(), CBID_VEHICLE_LENGTH, veh_len);
} else {
/* Use callback 11 */
veh_len = GetVehicleCallback(CBID_VEHICLE_LENGTH, 0, 0, v->engine_type, v);
}
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);
return length;
@@ -205,19 +205,20 @@ void Train::ConsistChanged(bool same_len
/* check the vehicle length (callback) */
if (e_u->GetGRF() != NULL && e_u->GetGRF()->grf_version >= 8) {
veh_len = GetVehicleProperty(u, PROP_TRAIN_SHORTEN_FACTOR, CALLBACK_FAILED);
if (veh_len != CALLBACK_FAILED && veh_len >= VEHICLE_LENGTH) {
ErrorUnknownCallbackResult(e_u->GetGRFID(), CBID_VEHICLE_LENGTH, veh_len);
} else if (HasBit(e_u->info.callback_mask, CBM_VEHICLE_LENGTH)) {
veh_len = GetVehicleCallback(CBID_VEHICLE_LENGTH, 0, 0, u->engine_type, u);
if (veh_len == CALLBACK_FAILED) veh_len = rvi_u->shorten_factor;
veh_len = VEHICLE_LENGTH - Clamp(veh_len, 0, VEHICLE_LENGTH - 1);
/* verify length hasn't changed */
if (same_length && veh_len != u->gcache.cached_veh_length) VehicleLengthChanged(u);
Status change: