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

Function FootpathQueueCountConnections

src/openrct2/world/Footpath.cpp:983–1029  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

981 }
982
983 int32_t FootpathQueueCountConnections(const CoordsXY& position, const PathElement& pathElement)
984 {
985 int32_t connectionCount = 0;
986 for (const Direction direction : kAllDirections)
987 {
988 const uint8_t edge = 1 << direction;
989 if (pathElement.GetEdges() & edge)
990 {
991 const CoordsXY adjacentPathPosition = position + CoordsDirectionDelta[direction];
992 const int32_t z = pathElement.getBaseZ();
993 const TileElement* tileElement = FootpathGetElement(
994 { adjacentPathPosition, z, z + kLandHeightStep }, direction);
995
996 if (tileElement == nullptr)
997 {
998 tileElement = FootpathGetElement({ adjacentPathPosition, z - kLandHeightStep, z }, direction);
999
1000 if (tileElement == nullptr)
1001 {
1002 const EntranceElement* entrance = MapGetRideEntranceElementAt(
1003 CoordsXYZ{ adjacentPathPosition, z }, true);
1004 if (entrance == nullptr)
1005 {
1006 entrance = MapGetRideEntranceElementAt(
1007 CoordsXYZ{ adjacentPathPosition, z + kLandHeightStep }, true);
1008 if (entrance == nullptr)
1009 continue;
1010 }
1011
1012 if (entrance_has_direction(*entrance, direction + entrance->getDirection()))
1013 {
1014 connectionCount++;
1015 }
1016 continue;
1017 }
1018 }
1019
1020 const PathElement& adjacentPath = *tileElement->asPath();
1021
1022 if (adjacentPath.GetEdges() & Numerics::rol4(edge, 2))
1023 {
1024 connectionCount++;
1025 }
1026 }
1027 }
1028 return connectionCount;
1029 }
1030
1031 /**
1032 *

Callers 1

Calls 8

FootpathGetElementFunction · 0.85
entrance_has_directionFunction · 0.85
rol4Function · 0.85
GetEdgesMethod · 0.45
getBaseZMethod · 0.45
getDirectionMethod · 0.45
asPathMethod · 0.45

Tested by

no test coverage detected