| 195 | constexpr auto kNullTransformFunction = [](const RoutingResults&) {}; |
| 196 | |
| 197 | static std::optional<std::pair<World::SignalElement*, World::TrackElement*>> findSignalOnTrack(const World::Pos3& signalLoc, const TrackAndDirection::_TrackAndDirection trackAndDirection, const uint8_t trackType, const uint8_t index) |
| 198 | { |
| 199 | auto tile = World::TileManager::get(signalLoc); |
| 200 | for (auto& el : tile) |
| 201 | { |
| 202 | if (el.baseZ() != signalLoc.z / 4) |
| 203 | { |
| 204 | continue; |
| 205 | } |
| 206 | |
| 207 | auto* elTrack = el.as<TrackElement>(); |
| 208 | if (elTrack == nullptr) |
| 209 | { |
| 210 | continue; |
| 211 | } |
| 212 | |
| 213 | if (!elTrack->hasSignal()) |
| 214 | { |
| 215 | continue; |
| 216 | } |
| 217 | |
| 218 | if (elTrack->rotation() != trackAndDirection.cardinalDirection()) |
| 219 | { |
| 220 | continue; |
| 221 | } |
| 222 | |
| 223 | if (elTrack->sequenceIndex() != index) |
| 224 | { |
| 225 | continue; |
| 226 | } |
| 227 | |
| 228 | if (elTrack->trackObjectId() != trackType) |
| 229 | { |
| 230 | continue; |
| 231 | } |
| 232 | |
| 233 | if (elTrack->trackId() != trackAndDirection.id()) |
| 234 | { |
| 235 | continue; |
| 236 | } |
| 237 | return std::make_pair(elTrack->next()->as<SignalElement>(), elTrack); |
| 238 | } |
| 239 | return std::nullopt; |
| 240 | } |
| 241 | |
| 242 | // 0x0048963F but only when flags are 0xXXXX_XXXA |
| 243 | SignalStateFlags getSignalState(const World::Pos3& loc, const TrackAndDirection::_TrackAndDirection trackAndDirection, const uint8_t trackType, uint32_t flags) |
no test coverage detected