MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / PeepInteractWithEntrance

Function PeepInteractWithEntrance

src/openrct2/entity/Peep.cpp:1631–1935  ·  view source on GitHub ↗

* * rct2: 0x00693f2C */

Source from the content-addressed store, hash-verified

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;

Callers 1

PerformNextActionMethod · 0.85

Calls 15

PeepReturnToCentreOfTileFunction · 0.85
GetRideFunction · 0.85
DirectionReverseFunction · 0.85
PeepWindowStateUpdateFunction · 0.85
MapGetFirstElementAtFunction · 0.85
GetEntranceFeeFunction · 0.85
AddClampFunction · 0.85
GetWindowManagerFunction · 0.85
shouldGoOnRideMethod · 0.80
FormatNameToMethod · 0.80
formatNameToMethod · 0.80

Tested by

no test coverage detected