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

Function FootpathGetElement

src/openrct2/world/Footpath.cpp:364–397  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

362 }
363
364 static TileElement* FootpathGetElement(const CoordsXYRangedZ& footpathPos, int32_t direction)
365 {
366 TileElement* tileElement = MapGetFirstElementAt(footpathPos);
367 if (tileElement == nullptr)
368 return nullptr;
369 do
370 {
371 if (tileElement->getType() != TileElementType::Path)
372 continue;
373
374 if (footpathPos.clearanceZ == tileElement->getBaseZ())
375 {
376 if (tileElement->asPath()->IsSloped())
377 {
378 auto slope = tileElement->asPath()->GetSlopeDirection();
379 if (slope != direction)
380 break;
381 }
382 return tileElement;
383 }
384 if (footpathPos.baseZ == tileElement->getBaseZ())
385 {
386 if (!tileElement->asPath()->IsSloped())
387 break;
388
389 auto slope = DirectionReverse(tileElement->asPath()->GetSlopeDirection());
390 if (slope != direction)
391 break;
392
393 return tileElement;
394 }
395 } while (!(tileElement++)->isLastForTile());
396 return nullptr;
397 }
398
399 /**
400 * Attempt to connect a newly disconnected queue tile to the specified path tile

Callers 2

Calls 8

MapGetFirstElementAtFunction · 0.85
DirectionReverseFunction · 0.85
getTypeMethod · 0.45
getBaseZMethod · 0.45
IsSlopedMethod · 0.45
asPathMethod · 0.45
GetSlopeDirectionMethod · 0.45
isLastForTileMethod · 0.45

Tested by

no test coverage detected