summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2020-05-03 22:05:13 +0200
committerfrosch <github@elsenhans.name>2020-05-03 23:18:30 +0200
commit0f9dc88834fd6b44a62b1f3395e71653008f69e9 (patch)
tree8ac907c243ef4f0dd130c4b5a15f844a5a1224cf /src
parent68244393f1b590fd7f108854b197cbd16fa94686 (diff)
downloadopenttd-0f9dc88834fd6b44a62b1f3395e71653008f69e9.tar.xz
Fix: When build+refit an engine, do not refit any free wagons that may get attached.
Diffstat (limited to 'src')
-rw-r--r--src/vehicle_cmd.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/vehicle_cmd.cpp b/src/vehicle_cmd.cpp
index a5eb2087b..7383e1d4a 100644
--- a/src/vehicle_cmd.cpp
+++ b/src/vehicle_cmd.cpp
@@ -151,7 +151,8 @@ CommandCost CmdBuildVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
}
if (refitting) {
- value.AddCost(CmdRefitVehicle(tile, flags, v->index, cargo, nullptr));
+ /* Refit only one vehicle. If we purchased an engine, it may have gained free wagons. */
+ value.AddCost(CmdRefitVehicle(tile, flags, v->index, cargo | (1 << 16), nullptr));
} else {
/* Fill in non-refitted capacities */
_returned_refit_capacity = e->GetDisplayDefaultCapacity(&_returned_mail_refit_capacity);