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

Function FootpathElementNextInDirection

src/openrct2/peep/GuestPathfinding.cpp:344–378  ·  view source on GitHub ↗

* * Returns: * PathSearchResult::Wide - path with wide flag set * PathSearchResult::RideQueue - queue path connected to a ride * PathSearchResult::Other - other path than the above * PathSearchResult::Failed - no path element found * * rct2: 0x00694BAE * * Returns the type of the next footpath tile a peep can get to from x,y,z / * inputTil

Source from the content-addressed store, hash-verified

342 * inputTileElement in the given direction.
343 */
344 static PathSearchResult FootpathElementNextInDirection(
345 TileCoordsXYZ loc, PathElement* pathElement, Direction chosenDirection)
346 {
347 if (pathElement->IsSloped())
348 {
349 if (pathElement->GetSlopeDirection() == chosenDirection)
350 {
351 loc.z += 2;
352 }
353 }
354
355 loc += TileDirectionDelta[chosenDirection];
356 TileElement* nextTileElement = MapGetFirstElementAt(loc);
357 do
358 {
359 if (nextTileElement == nullptr)
360 break;
361 if (nextTileElement->isGhost())
362 continue;
363 if (nextTileElement->getType() != TileElementType::Path)
364 continue;
365 const auto* nextPathElement = nextTileElement->asPath();
366 if (!FootpathIsZAndDirectionValid(*nextPathElement, loc.z, chosenDirection))
367 continue;
368 if (nextPathElement->IsWide())
369 return PathSearchResult::Wide;
370 // Only queue tiles that are connected to a ride are returned as ride queues.
371 if (nextPathElement->IsQueue() && !nextPathElement->GetRideIndex().IsNull())
372 return PathSearchResult::RideQueue;
373
374 return PathSearchResult::Other;
375 } while (!(nextTileElement++)->isLastForTile());
376
377 return PathSearchResult::Failed;
378 }
379
380 /**
381 *

Callers 2

PathIsThinJunctionFunction · 0.85
CalculateNextDestinationFunction · 0.85

Calls 12

MapGetFirstElementAtFunction · 0.85
IsSlopedMethod · 0.45
GetSlopeDirectionMethod · 0.45
isGhostMethod · 0.45
getTypeMethod · 0.45
asPathMethod · 0.45
IsWideMethod · 0.45
IsQueueMethod · 0.45
IsNullMethod · 0.45
GetRideIndexMethod · 0.45
isLastForTileMethod · 0.45

Tested by

no test coverage detected