0x00462937
| 381 | |
| 382 | // 0x00462937 |
| 383 | static bool canConstructAtWithClear(const World::Pos2& pos, uint8_t baseZ, uint8_t clearZ, const QuarterTile& qt, BuildingCollisionType flags, std::function<ClearFuncResult(TileElement& el)> clearFunc) |
| 384 | { |
| 385 | _constructAtElementPositionFlags = ElementPositionFlags::aboveGround; |
| 386 | if (!drawableCoords(pos)) |
| 387 | { |
| 388 | GameCommands::setErrorText(StringIds::off_edge_of_map); |
| 389 | return false; |
| 390 | } |
| 391 | |
| 392 | bool collisionRemoved = false; |
| 393 | do |
| 394 | { |
| 395 | collisionRemoved = false; |
| 396 | const auto tile = TileManager::get(pos); |
| 397 | for (auto& el : tile) |
| 398 | { |
| 399 | const auto* elSurface = el.as<SurfaceElement>(); |
| 400 | const auto res = elSurface == nullptr ? canConstructAtCheckNonSurfaceElement(baseZ, clearZ, qt, flags, clearFunc, el) |
| 401 | : canConstructAtCheckSurfaceElement(baseZ, clearZ, qt, clearFunc, el, *elSurface); |
| 402 | switch (res) |
| 403 | { |
| 404 | case ClearFuncResult::noCollision: |
| 405 | break; |
| 406 | case ClearFuncResult::allCollisionsRemoved: |
| 407 | return true; |
| 408 | case ClearFuncResult::collision: |
| 409 | setCollisionErrorMessage(el); |
| 410 | return false; |
| 411 | case ClearFuncResult::collisionRemoved: |
| 412 | collisionRemoved = true; |
| 413 | break; |
| 414 | case ClearFuncResult::collisionErrorSet: |
| 415 | return false; |
| 416 | } |
| 417 | if (collisionRemoved) |
| 418 | { |
| 419 | break; |
| 420 | } |
| 421 | } |
| 422 | } while (collisionRemoved); |
| 423 | return true; |
| 424 | } |
| 425 | |
| 426 | // 0x00462908 |
| 427 | bool applyClearAtAllHeights(const World::Pos2& pos, uint8_t baseZ, uint8_t clearZ, const QuarterTile& qt, std::function<ClearFuncResult(TileElement& el)> clearFunc) |
no test coverage detected