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

Method updateRideLeaveExit

src/openrct2/entity/Guest.cpp:5095–5143  ·  view source on GitHub ↗

* * rct2: 0x006938D2 */

Source from the content-addressed store, hash-verified

5093 * rct2: 0x006938D2
5094 */
5095 void Guest::updateRideLeaveExit()
5096 {
5097 auto ride = GetRide(CurrentRide);
5098
5099 if (auto loc = UpdateAction(); loc.has_value())
5100 {
5101 if (ride != nullptr)
5102 {
5103 moveTo({ loc.value(), ride->getStation(CurrentRideStation).GetBaseZ() });
5104 }
5105 return;
5106 }
5107
5108 if (ride != nullptr)
5109 {
5110 onExitRide(*ride);
5111
5112 if (PeepFlags & PEEP_FLAGS_TRACKING)
5113 {
5114 auto ft = Formatter();
5115 FormatNameTo(ft);
5116 ride->formatNameTo(ft);
5117
5118 if (Config::Get().notifications.guestLeftRide)
5119 {
5120 News::AddItemToQueue(News::ItemType::peepOnRide, STR_PEEP_TRACKING_LEFT_RIDE_X, id, ft);
5121 }
5122 }
5123 }
5124
5125 InteractionRideIndex = RideId::GetNull();
5126 SetState(PeepState::falling);
5127
5128 CoordsXY targetLoc = { x, y };
5129
5130 // Find the station track element
5131 for (auto* pathElement : TileElementsView<PathElement>(targetLoc))
5132 {
5133 int16_t height = MapHeightFromSlope(targetLoc, pathElement->GetSlopeDirection(), pathElement->IsSloped());
5134 height += pathElement->getBaseZ();
5135
5136 int16_t z_diff = z - height;
5137 if (z_diff > 0 || z_diff < -16)
5138 continue;
5139
5140 moveTo({ x, y, height });
5141 return;
5142 }
5143 }
5144
5145 /**
5146 *

Callers

nothing calls this directly

Calls 9

GetRideFunction · 0.85
MapHeightFromSlopeFunction · 0.85
valueMethod · 0.80
GetBaseZMethod · 0.80
formatNameToMethod · 0.80
FormatterClass · 0.70
GetSlopeDirectionMethod · 0.45
IsSlopedMethod · 0.45
getBaseZMethod · 0.45

Tested by

no test coverage detected