From b49a38bf6c5acbf33cb3dc0143e9eea16c2930a7 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Thu, 1 Feb 2024 02:34:49 +0000 Subject: [PATCH] Fix build and refit with multi-cargo ships only refitting first part --- src/vehicle_cmd.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/vehicle_cmd.cpp b/src/vehicle_cmd.cpp index ea9202be6b7..3b7438e0465 100644 --- a/src/vehicle_cmd.cpp +++ b/src/vehicle_cmd.cpp @@ -165,8 +165,9 @@ CommandCost CmdBuildVehicle(TileIndex tile, DoCommandFlag flags, uint32_t p1, ui } if (refitting) { - /* 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)); + /* Refit only one vehicle. If we purchased an engine, it may have gained free wagons. + * For ships try to refit all parts. */ + value.AddCost(CmdRefitVehicle(tile, flags, v->index, cargo | (v->type == VEH_SHIP ? 0 : (1 << 16)), nullptr)); } else { /* Fill in non-refitted capacities */ if (e->type == VEH_TRAIN || e->type == VEH_ROAD || e->type == VEH_SHIP) {