|
@@ -197,13 +197,15 @@ void Train::ConsistChanged(bool same_len
|
|
|
if ((rvi_u->railveh_type != RAILVEH_WAGON || _settings_game.vehicle.wagon_speed_limits) && !UsesWagonOverride(u)) {
|
|
|
uint16 speed = GetVehicleProperty(u, PROP_TRAIN_SPEED, rvi_u->max_speed);
|
|
|
if (speed != 0) max_speed = min(speed, max_speed);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
u->cargo_cap = e_u->DetermineCapacity(u);
|
|
|
uint16 new_cap = e_u->DetermineCapacity(u);
|
|
|
u->refit_cap = min(new_cap, u->refit_cap);
|
|
|
u->cargo_cap = new_cap;
|
|
|
u->vcache.cached_cargo_age_period = GetVehicleProperty(u, PROP_TRAIN_CARGO_AGE_PERIOD, e_u->info.cargo_age_period);
|
|
|
|
|
|
/* check the vehicle length (callback) */
|
|
|
uint16 veh_len = CALLBACK_FAILED;
|
|
|
if (e_u->GetGRF() != NULL && e_u->GetGRF()->grf_version >= 8) {
|
|
|
/* Use callback 36 */
|
|
@@ -603,12 +605,13 @@ static CommandCost CmdBuildRailWagon(Til
|
|
|
|
|
|
v->SetFreeWagon();
|
|
|
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
|
|
|
|
|
|
v->cargo_type = e->GetDefaultCargoType();
|
|
|
v->cargo_cap = rvi->capacity;
|
|
|
v->refit_cap = 0;
|
|
|
|
|
|
v->railtype = rvi->railtype;
|
|
|
|
|
|
v->build_year = _cur_year;
|
|
|
v->cur_image = SPR_IMG_QUERY;
|
|
|
v->random_bits = VehicleRandomBits();
|
|
@@ -670,12 +673,13 @@ static void AddRearEngineToMultiheadedTr
|
|
|
u->track = TRACK_BIT_DEPOT;
|
|
|
u->vehstatus = v->vehstatus & ~VS_STOPPED;
|
|
|
u->spritenum = v->spritenum + 1;
|
|
|
u->cargo_type = v->cargo_type;
|
|
|
u->cargo_subtype = v->cargo_subtype;
|
|
|
u->cargo_cap = v->cargo_cap;
|
|
|
u->refit_cap = v->refit_cap;
|
|
|
u->railtype = v->railtype;
|
|
|
u->engine_type = v->engine_type;
|
|
|
u->build_year = v->build_year;
|
|
|
u->cur_image = SPR_IMG_QUERY;
|
|
|
u->random_bits = VehicleRandomBits();
|
|
|
v->SetMultiheaded();
|
|
@@ -722,13 +726,15 @@ CommandCost CmdBuildRailVehicle(TileInde
|
|
|
v->z_pos = GetSlopePixelZ(x, y);
|
|
|
v->track = TRACK_BIT_DEPOT;
|
|
|
v->vehstatus = VS_HIDDEN | VS_STOPPED | VS_DEFPAL;
|
|
|
v->spritenum = rvi->image_index;
|
|
|
v->cargo_type = e->GetDefaultCargoType();
|
|
|
v->cargo_cap = rvi->capacity;
|
|
|
v->refit_cap = 0;
|
|
|
v->last_station_visited = INVALID_STATION;
|
|
|
v->last_loading_station = INVALID_STATION;
|
|
|
|
|
|
v->engine_type = e->index;
|
|
|
v->gcache.first_engine = INVALID_ENGINE; // needs to be set before first callback
|
|
|
|
|
|
v->reliability = e->reliability;
|
|
|
v->reliability_spd_dec = e->reliability_spd_dec;
|