| 80 | } |
| 81 | |
| 82 | void PaintSession::setMaxHeight(const World::Pos2& loc) |
| 83 | { |
| 84 | auto tile = World::TileManager::get(loc); |
| 85 | uint8_t maxClearZ = 0; |
| 86 | for (const auto& el : tile) |
| 87 | { |
| 88 | maxClearZ = std::max(maxClearZ, el.clearZ()); |
| 89 | const auto* surface = el.as<World::SurfaceElement>(); |
| 90 | if (!surface) |
| 91 | { |
| 92 | continue; |
| 93 | } |
| 94 | |
| 95 | if (surface->water()) |
| 96 | { |
| 97 | maxClearZ = std::max<uint8_t>(maxClearZ, surface->water() * World::kMicroToSmallZStep); |
| 98 | } |
| 99 | if (surface->isIndustrial()) |
| 100 | { |
| 101 | maxClearZ = std::max<uint8_t>(maxClearZ, surface->clearZ() + 24); |
| 102 | } |
| 103 | } |
| 104 | _maxHeight = (maxClearZ * World::kSmallZStep) + 32; |
| 105 | } |
| 106 | |
| 107 | /* |
| 108 | * Flips the X axis so 1 and 3 are swapped 0 and 2 will stay the same. |
no test coverage detected