| 99 | } |
| 100 | |
| 101 | StationElement* Tile::trainStation(uint8_t trackId, uint8_t direction, uint8_t baseZ) const |
| 102 | { |
| 103 | StationElement* result = nullptr; |
| 104 | bool trackFound = false; |
| 105 | for (auto& tile : *this) |
| 106 | { |
| 107 | if (trackFound) |
| 108 | { |
| 109 | result = tile.as<StationElement>(); |
| 110 | if (result != nullptr) |
| 111 | { |
| 112 | break; |
| 113 | } |
| 114 | } |
| 115 | auto* elTrack = tile.as<TrackElement>(); |
| 116 | if (elTrack == nullptr) |
| 117 | { |
| 118 | continue; |
| 119 | } |
| 120 | trackFound = false; |
| 121 | if (elTrack->baseZ() != baseZ) |
| 122 | { |
| 123 | continue; |
| 124 | } |
| 125 | if (elTrack->rotation() != direction) |
| 126 | { |
| 127 | continue; |
| 128 | } |
| 129 | if (elTrack->trackId() != trackId) |
| 130 | { |
| 131 | continue; |
| 132 | } |
| 133 | if (!elTrack->hasStationElement()) |
| 134 | { |
| 135 | continue; |
| 136 | } |
| 137 | trackFound = true; |
| 138 | } |
| 139 | return result; |
| 140 | } |
| 141 | |
| 142 | StationElement* Tile::roadStation(uint8_t roadId, uint8_t direction, uint8_t baseZ) const |
| 143 | { |
no test coverage detected