Skip to content

Commit 5dea170

Browse files
authored
Fix OpenTTD#14588: Show error when unable to clone partly-cleared crashed train (OpenTTD#14591)
1 parent faacae2 commit 5dea170

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/vehicle_cmd.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,8 @@ std::tuple<CommandCost, VehicleID> CmdCloneVehicle(DoCommandFlags flags, TileInd
849849
CommandCost ret = CheckOwnership(v->owner);
850850
if (ret.Failed()) return { ret, VehicleID::Invalid() };
851851

852-
if (v->type == VEH_TRAIN && (!v->IsFrontEngine() || Train::From(v)->crash_anim_pos >= 4400)) return { CMD_ERROR, VehicleID::Invalid() };
852+
/* Crashed trains can only be cloned before cleanup begins. */
853+
if (v->type == VEH_TRAIN && (!v->IsFrontEngine() || Train::From(v)->crash_anim_pos >= 4400)) return { CommandCost(STR_ERROR_VEHICLE_IS_DESTROYED), VehicleID::Invalid() };
853854

854855
/* check that we can allocate enough vehicles */
855856
if (!flags.Test(DoCommandFlag::Execute)) {

0 commit comments

Comments
 (0)