* Find the end of a railway station, from the \a tile, in the direction of \a delta. * @param tile Start tile. * @param delta Movement direction. * @param check_type Stop when the custom station type changes. * @param check_axis Stop when the station direction changes. * @return Found end of the railway station. */
| 156 | * @return Found end of the railway station. |
| 157 | */ |
| 158 | static TileIndex FindRailStationEnd(TileIndex tile, TileIndexDiff delta, bool check_type, bool check_axis) |
| 159 | { |
| 160 | uint8_t orig_type = 0; |
| 161 | Axis orig_axis = AXIS_X; |
| 162 | StationID sid = GetStationIndex(tile); |
| 163 | |
| 164 | if (check_type) orig_type = GetCustomStationSpecIndex(tile); |
| 165 | if (check_axis) orig_axis = GetRailStationAxis(tile); |
| 166 | |
| 167 | for (;;) { |
| 168 | TileIndex new_tile = TileAdd(tile, delta); |
| 169 | |
| 170 | if (!IsTileType(new_tile, MP_STATION) || GetStationIndex(new_tile) != sid) break; |
| 171 | if (!HasStationRail(new_tile)) break; |
| 172 | if (check_type && GetCustomStationSpecIndex(new_tile) != orig_type) break; |
| 173 | if (check_axis && GetRailStationAxis(new_tile) != orig_axis) break; |
| 174 | |
| 175 | tile = new_tile; |
| 176 | } |
| 177 | return tile; |
| 178 | } |
| 179 | |
| 180 | |
| 181 | static uint32_t GetPlatformInfoHelper(TileIndex tile, bool check_type, bool check_axis, bool centred) |
no test coverage detected