@@ -626,24 +626,25 @@ static int32 CmdBuildRailWagon(EngineID
v->build_year = _cur_year;
v->type = VEH_Train;
v->cur_image = 0xAC2;
v->random_bits = VehicleRandomBits();
AddArticulatedParts(vl);
_new_vehicle_id = v->index;
VehiclePositionChanged(v);
TrainConsistChanged(GetFirstVehicleInChain(v));
GetPlayer(_current_player)->num_engines[engine]++;
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
if (IsLocalPlayer()) {
InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Train); // updates the replace Train window
}
return value;
// Move all free vehicles in the depot to the train
@@ -806,24 +807,25 @@ int32 CmdBuildRailVehicle(TileIndex tile
vl[1]->u.rail.other_multiheaded_part = vl[0];
} else {
TrainConsistChanged(v);
UpdateTrainAcceleration(v);
if (!HASBIT(p2, 1)) { // check if the cars should be added to the new vehicle
NormalizeTrainVehInDepot(v);
GetPlayer(_current_player)->num_engines[p1]++;
InvalidateWindow(WC_VEHICLE_DEPOT, tile);
RebuildVehicleLists();
InvalidateWindow(WC_COMPANY, v->owner);