Skip to content

Commit

Permalink
Fix OpenTTD#7982: Show existing coverage with unambiguous adjacent st…
Browse files Browse the repository at this point in the history
…ation (OpenTTD#12346)

When hovering a tile containing a station, show existing coverage for
that station even when adjacent to a different station.

Co-authored-by: Peter Nelson <[email protected]>
  • Loading branch information
raddari and PeterN authored Mar 22, 2024
1 parent e141734 commit 5751da7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/station_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,15 @@ void FindStationsAroundSelection()
/* Tile area for TileHighlightData */
TileArea location(TileVirtXY(_thd.pos.x, _thd.pos.y), _thd.size.x / TILE_SIZE - 1, _thd.size.y / TILE_SIZE - 1);

/* If the current tile is already a station, then it must be the nearest station. */
if (IsTileType(location.tile, MP_STATION) && GetTileOwner(location.tile) == _local_company) {
T* st = T::GetByTile(location.tile);
if (st != nullptr) {
SetViewportCatchmentSpecializedStation<T>(st, true);
return;
}
}

/* Extended area by one tile */
uint x = TileX(location.tile);
uint y = TileY(location.tile);
Expand Down

0 comments on commit 5751da7

Please sign in to comment.