| 5662 | } |
| 5663 | |
| 5664 | ResultWithMessage Ride::changeStatusCheckTrackValidity(const CoordsXYE& trackElement, bool isSimulating) |
| 5665 | { |
| 5666 | CoordsXYE problematicTrackElement = {}; |
| 5667 | |
| 5668 | if (isBlockSectioned()) |
| 5669 | { |
| 5670 | auto blockBrakeCheck = RideCheckBlockBrakes(trackElement, &problematicTrackElement, !isSimulating); |
| 5671 | if (!blockBrakeCheck.Successful) |
| 5672 | { |
| 5673 | RideScrollToTrackError(problematicTrackElement); |
| 5674 | return { false, blockBrakeCheck.Message }; |
| 5675 | } |
| 5676 | } |
| 5677 | |
| 5678 | if (subtype != kObjectEntryIndexNull && !getGameState().cheats.enableAllDrawableTrackPieces) |
| 5679 | { |
| 5680 | const auto* rideEntry = GetRideEntryByIndex(subtype); |
| 5681 | if (rideEntry == nullptr) |
| 5682 | { |
| 5683 | return { false, STR_UNKNOWN_RIDE }; |
| 5684 | } |
| 5685 | if (rideEntry->flags.has(RideEntryFlag::noInversions)) |
| 5686 | { |
| 5687 | if (RideCheckTrackContainsInversions(trackElement, &problematicTrackElement)) |
| 5688 | { |
| 5689 | RideScrollToTrackError(problematicTrackElement); |
| 5690 | return { false, STR_TRACK_UNSUITABLE_FOR_TYPE_OF_TRAIN }; |
| 5691 | } |
| 5692 | } |
| 5693 | if (rideEntry->flags.has(RideEntryFlag::noBankedTrack)) |
| 5694 | { |
| 5695 | if (RideCheckTrackContainsBanked(trackElement, &problematicTrackElement)) |
| 5696 | { |
| 5697 | RideScrollToTrackError(problematicTrackElement); |
| 5698 | return { false, STR_TRACK_UNSUITABLE_FOR_TYPE_OF_TRAIN }; |
| 5699 | } |
| 5700 | } |
| 5701 | } |
| 5702 | |
| 5703 | if (mode == RideMode::stationToStation) |
| 5704 | { |
| 5705 | if (!findTrackGap(*this, trackElement, &problematicTrackElement)) |
| 5706 | { |
| 5707 | return { false, STR_RIDE_MUST_START_AND_END_WITH_STATIONS }; |
| 5708 | } |
| 5709 | |
| 5710 | if (!RideCheckStationLength(trackElement, &problematicTrackElement)) |
| 5711 | { |
| 5712 | RideScrollToTrackError(problematicTrackElement); |
| 5713 | return { false, STR_STATION_NOT_LONG_ENOUGH }; |
| 5714 | } |
| 5715 | |
| 5716 | if (!RideCheckStartAndEndIsStation(trackElement)) |
| 5717 | { |
| 5718 | RideScrollToTrackError(problematicTrackElement); |
| 5719 | return { false, STR_RIDE_MUST_START_AND_END_WITH_STATIONS }; |
| 5720 | } |
| 5721 | } |
nothing calls this directly
no test coverage detected