| 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 |
no test coverage detected