|
@@ -1199,13 +1199,13 @@ CommandCost CmdMoveRailVehicle(DoCommand
|
|
|
if (dest_veh == INVALID_VEHICLE) {
|
|
|
dst = (src->IsEngine() || (flags & DC_AUTOREPLACE)) ? nullptr : FindGoodVehiclePos(src);
|
|
|
} else {
|
|
|
dst = Train::GetIfValid(dest_veh);
|
|
|
if (dst == nullptr) return CMD_ERROR;
|
|
|
|
|
|
CommandCost ret = CheckOwnership(dst->owner);
|
|
|
ret = CheckOwnership(dst->owner);
|
|
|
if (ret.Failed()) return ret;
|
|
|
|
|
|
/* Do not allow appending to crashed vehicles, too */
|
|
|
if (dst->vehstatus & VS_CRASHED) return CMD_ERROR;
|
|
|
}
|
|
|
|
|
@@ -1268,13 +1268,13 @@ CommandCost CmdMoveRailVehicle(DoCommand
|
|
|
ArrangeTrains(&dst_head, dst, &src_head, src, move_chain);
|
|
|
|
|
|
if ((flags & DC_AUTOREPLACE) == 0) {
|
|
|
/* If the autoreplace flag is set we do not need to test for the validity
|
|
|
* because we are going to revert the train to its original state. As we
|
|
|
* assume the original state was correct autoreplace can skip this. */
|
|
|
CommandCost ret = ValidateTrains(original_dst_head, dst_head, original_src_head, src_head, true);
|
|
|
ret = ValidateTrains(original_dst_head, dst_head, original_src_head, src_head, true);
|
|
|
if (ret.Failed()) {
|
|
|
/* Restore the train we had. */
|
|
|
RestoreTrainBackup(original_src);
|
|
|
RestoreTrainBackup(original_dst);
|
|
|
return ret;
|
|
|
}
|