| 68 | }; |
| 69 | |
| 70 | static World::RoadElement* getRoadElement(const World::Pos3 pos, const RoadRemovalArgs& args, uint8_t sequenceIndex, uint8_t flags) |
| 71 | { |
| 72 | auto tile = World::TileManager::get(pos); |
| 73 | const auto baseZ = pos.z / World::kSmallZStep; |
| 74 | const auto companyId = SceneManager::isEditorMode() ? CompanyId::neutral : getUpdatingCompanyId(); |
| 75 | |
| 76 | for (auto& element : tile) |
| 77 | { |
| 78 | auto* elRoad = element.as<World::RoadElement>(); |
| 79 | if (elRoad == nullptr) |
| 80 | { |
| 81 | continue; |
| 82 | } |
| 83 | if (elRoad->baseZ() != baseZ) |
| 84 | { |
| 85 | continue; |
| 86 | } |
| 87 | if (elRoad->rotation() != args.rotation) |
| 88 | { |
| 89 | continue; |
| 90 | } |
| 91 | if (elRoad->sequenceIndex() != sequenceIndex) |
| 92 | { |
| 93 | continue; |
| 94 | } |
| 95 | if (elRoad->roadObjectId() != args.objectId) |
| 96 | { |
| 97 | continue; |
| 98 | } |
| 99 | if (elRoad->roadId() != args.roadId) |
| 100 | { |
| 101 | continue; |
| 102 | } |
| 103 | if (elRoad->isGhost() != ((flags & Flags::ghost) != 0)) |
| 104 | { |
| 105 | continue; |
| 106 | } |
| 107 | if (elRoad->isAiAllocated() != ((flags & Flags::aiAllocated) != 0)) |
| 108 | { |
| 109 | continue; |
| 110 | } |
| 111 | // Ghost only as this is checked elsewhere for non-ghost so that |
| 112 | // neutral company is always allowed |
| 113 | if (((flags & Flags::ghost) != 0) && elRoad->owner() != companyId) |
| 114 | { |
| 115 | return nullptr; |
| 116 | } |
| 117 | |
| 118 | return elRoad; |
| 119 | } |
| 120 | |
| 121 | return nullptr; |
| 122 | } |
| 123 | |
| 124 | // 0x00477A10 |
| 125 | static currency32_t roadRemoveCost(const RoadRemovalArgs& args, const World::TrackData::PreviewTrack roadPiece0, const World::Pos3 roadStart, const uint8_t flags) |
no test coverage detected