Caused by incorrect order of operations when buying a train engine with refit and attaching free wagons.
This commit is contained in:
@@ -686,7 +686,7 @@ static CommandCost CmdBuildRailWagon(DoCommandFlag flags, TileIndex tile, const
|
||||
}
|
||||
|
||||
/** Move all free vehicles in the depot to the train */
|
||||
static void NormalizeTrainVehInDepot(const Train *u)
|
||||
void NormalizeTrainVehInDepot(const Train *u)
|
||||
{
|
||||
for (const Train *v : Train::Iterate()) {
|
||||
if (v->IsFreeWagon() && v->tile == u->tile &&
|
||||
@@ -737,11 +737,10 @@ static void AddRearEngineToMultiheadedTrain(Train *v)
|
||||
* @param flags type of operation.
|
||||
* @param tile tile of the depot where rail-vehicle is built.
|
||||
* @param e the engine to build.
|
||||
* @param free_cars add any free cars to the train.
|
||||
* @param[out] ret the vehicle that has been built.
|
||||
* @return the cost of this operation or an error.
|
||||
*/
|
||||
CommandCost CmdBuildRailVehicle(DoCommandFlag flags, TileIndex tile, const Engine *e, bool free_cars, Vehicle **ret)
|
||||
CommandCost CmdBuildRailVehicle(DoCommandFlag flags, TileIndex tile, const Engine *e, Vehicle **ret)
|
||||
{
|
||||
const RailVehicleInfo *rvi = &e->u.rail;
|
||||
|
||||
@@ -807,10 +806,6 @@ CommandCost CmdBuildRailVehicle(DoCommandFlag flags, TileIndex tile, const Engin
|
||||
v->ConsistChanged(CCF_ARRANGE);
|
||||
UpdateTrainGroupID(v);
|
||||
|
||||
if (free_cars && !(flags & DC_AUTOREPLACE)) { // check if the cars should be added to the new vehicle
|
||||
NormalizeTrainVehInDepot(v);
|
||||
}
|
||||
|
||||
CheckConsistencyOfArticulatedVehicle(v);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user