* * rct2: 0x00693f2C */
| 1629 | * rct2: 0x00693f2C |
| 1630 | */ |
| 1631 | static bool PeepInteractWithEntrance(Peep* peep, const CoordsXYE& coords, uint8_t& pathing_result) |
| 1632 | { |
| 1633 | auto tile_element = coords.element; |
| 1634 | uint8_t entranceType = tile_element->asEntrance()->GetEntranceType(); |
| 1635 | auto rideIndex = tile_element->asEntrance()->GetRideIndex(); |
| 1636 | |
| 1637 | if ((entranceType == ENTRANCE_TYPE_RIDE_ENTRANCE) || (entranceType == ENTRANCE_TYPE_RIDE_EXIT)) |
| 1638 | { |
| 1639 | // If an entrance or exit that doesn't belong to the ride we are queuing for ignore the entrance/exit |
| 1640 | // This can happen when paths clip through entrance/exits |
| 1641 | if (peep->State == PeepState::queuing && peep->CurrentRide != rideIndex) |
| 1642 | { |
| 1643 | return false; |
| 1644 | } |
| 1645 | } |
| 1646 | // Store some details to determine when to override the default |
| 1647 | // behaviour (defined below) for when staff attempt to enter a ride |
| 1648 | // to fix/inspect it. |
| 1649 | if (entranceType == ENTRANCE_TYPE_RIDE_EXIT) |
| 1650 | { |
| 1651 | pathing_result |= PATHING_RIDE_EXIT; |
| 1652 | _peepRideEntranceExitElement = tile_element; |
| 1653 | } |
| 1654 | else if (entranceType == ENTRANCE_TYPE_RIDE_ENTRANCE) |
| 1655 | { |
| 1656 | pathing_result |= PATHING_RIDE_ENTRANCE; |
| 1657 | _peepRideEntranceExitElement = tile_element; |
| 1658 | } |
| 1659 | |
| 1660 | if (entranceType == ENTRANCE_TYPE_RIDE_EXIT) |
| 1661 | { |
| 1662 | // Default guest/staff behaviour attempting to enter a |
| 1663 | // ride exit is to turn around. |
| 1664 | peep->InteractionRideIndex = RideId::GetNull(); |
| 1665 | PeepReturnToCentreOfTile(peep); |
| 1666 | return true; |
| 1667 | } |
| 1668 | |
| 1669 | if (entranceType == ENTRANCE_TYPE_RIDE_ENTRANCE) |
| 1670 | { |
| 1671 | auto ride = GetRide(rideIndex); |
| 1672 | if (ride == nullptr) |
| 1673 | return false; |
| 1674 | |
| 1675 | auto* guest = peep->as<Guest>(); |
| 1676 | if (guest == nullptr) |
| 1677 | { |
| 1678 | // Default staff behaviour attempting to enter a |
| 1679 | // ride entrance is to turn around. |
| 1680 | peep->InteractionRideIndex = RideId::GetNull(); |
| 1681 | PeepReturnToCentreOfTile(peep); |
| 1682 | return true; |
| 1683 | } |
| 1684 | |
| 1685 | if (guest->State == PeepState::queuing) |
| 1686 | { |
| 1687 | // Guest is in the ride queue. |
| 1688 | guest->RideSubState = PeepRideSubState::atQueueFront; |
no test coverage detected