* Iterates along the track until a banked track piece is reached. * @param input The start track element and position. * @param output The first track element and position which is banked. * @returns true if a banked track piece is found, otherwise false. * rct2: 0x006CB1D3 */
| 2564 | * rct2: 0x006CB1D3 |
| 2565 | */ |
| 2566 | static bool RideCheckTrackContainsBanked(const CoordsXYE& input, CoordsXYE* output) |
| 2567 | { |
| 2568 | if (input.element == nullptr) |
| 2569 | return false; |
| 2570 | |
| 2571 | const auto* trackElement = input.element->asTrack(); |
| 2572 | if (trackElement == nullptr) |
| 2573 | return false; |
| 2574 | |
| 2575 | auto rideIndex = trackElement->GetRideIndex(); |
| 2576 | auto ride = GetRide(rideIndex); |
| 2577 | if (ride == nullptr) |
| 2578 | return false; |
| 2579 | |
| 2580 | const auto& rtd = ride->getRideTypeDescriptor(); |
| 2581 | if (rtd.specialType == RtdSpecialType::maze) |
| 2582 | return true; |
| 2583 | |
| 2584 | auto* windowMgr = Ui::GetWindowManager(); |
| 2585 | WindowBase* w = windowMgr->FindByClass(WindowClass::rideConstruction); |
| 2586 | if (w != nullptr && _rideConstructionState != RideConstructionState::State0 && rideIndex == _currentRideIndex) |
| 2587 | { |
| 2588 | RideConstructionInvalidateCurrentTrack(); |
| 2589 | } |
| 2590 | |
| 2591 | bool moveSlowIt = true; |
| 2592 | TrackCircuitIterator it, slowIt; |
| 2593 | trackCircuitIteratorBegin(&it, input); |
| 2594 | slowIt = it; |
| 2595 | |
| 2596 | while (trackCircuitIteratorNext(&it)) |
| 2597 | { |
| 2598 | auto trackType = it.current.element->asTrack()->GetTrackType(); |
| 2599 | const auto& ted = GetTrackElementDescriptor(trackType); |
| 2600 | if (ted.flags.has(TrackElementFlag::banked)) |
| 2601 | { |
| 2602 | *output = it.current; |
| 2603 | return true; |
| 2604 | } |
| 2605 | |
| 2606 | // Prevents infinite loops |
| 2607 | moveSlowIt = !moveSlowIt; |
| 2608 | if (moveSlowIt) |
| 2609 | { |
| 2610 | trackCircuitIteratorNext(&slowIt); |
| 2611 | if (trackCircuitIteratorsMatch(&it, &slowIt)) |
| 2612 | { |
| 2613 | return false; |
| 2614 | } |
| 2615 | } |
| 2616 | } |
| 2617 | return false; |
| 2618 | } |
| 2619 | |
| 2620 | /** |
| 2621 | * |
no test coverage detected