diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp --- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -428,13 +428,15 @@ if (!IsCompatibleRail(GetRailType(tile), railtype)) return_cmd_error(STR_ERROR_IMPOSSIBLE_TRACK_COMBINATION); ret = CheckTrackCombination(tile, trackbit, flags); - if (ret.Succeeded()) ret = EnsureNoTrainOnTrack(tile, track); if (ret.Failed()) return ret; ret = CheckRailSlope(tileh, trackbit, GetTrackBits(tile), tile); if (ret.Failed()) return ret; cost.AddCost(ret); + ret = EnsureNoTrainOnTrack(tile, track); + if (ret.Failed()) return ret; + /* If the rail types don't match, try to convert only if engines of * the new rail type are not powered on the present rail type and engines of * the present rail type are powered on the new rail type. */