|
@@ -2095,50 +2095,50 @@ const StringID StationViewWindow::_group
|
|
|
|
|
|
static WindowDesc _station_view_desc(
|
|
|
WDP_AUTO, "view_station", 249, 117,
|
|
|
WC_STATION_VIEW, WC_NONE,
|
|
|
0,
|
|
|
_nested_station_view_widgets, lengthof(_nested_station_view_widgets)
|
|
|
);
|
|
|
|
|
|
/**
|
|
|
* Opens StationViewWindow for given station
|
|
|
*
|
|
|
* @param station station which window should be opened
|
|
|
*/
|
|
|
void ShowStationViewWindow(StationID station)
|
|
|
{
|
|
|
AllocateWindowDescFront<StationViewWindow>(&_station_view_desc, station);
|
|
|
}
|
|
|
|
|
|
/** Struct containing TileIndex and StationID */
|
|
|
struct TileAndStation {
|
|
|
TileIndex tile; ///< TileIndex
|
|
|
StationID station; ///< StationID
|
|
|
};
|
|
|
|
|
|
static SmallVector<TileAndStation, 8> _deleted_stations_nearby;
|
|
|
static SmallVector<StationID, 8> _stations_nearby_list;
|
|
|
static std::vector<TileAndStation> _deleted_stations_nearby;
|
|
|
static std::vector<StationID> _stations_nearby_list;
|
|
|
|
|
|
/**
|
|
|
* Add station on this tile to _stations_nearby_list if it's fully within the
|
|
|
* station spread.
|
|
|
* @param tile Tile just being checked
|
|
|
* @param user_data Pointer to TileArea context
|
|
|
* @tparam T the type of station to look for
|
|
|
*/
|
|
|
template <class T>
|
|
|
static bool AddNearbyStation(TileIndex tile, void *user_data)
|
|
|
{
|
|
|
TileArea *ctx = (TileArea *)user_data;
|
|
|
|
|
|
/* First check if there were deleted stations here */
|
|
|
for (uint i = 0; i < _deleted_stations_nearby.size(); i++) {
|
|
|
auto ts = _deleted_stations_nearby.begin() + i;
|
|
|
if (ts->tile == tile) {
|
|
|
_stations_nearby_list.push_back(_deleted_stations_nearby[i].station);
|
|
|
_deleted_stations_nearby.erase(ts);
|
|
|
i--;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/* Check if own station and if we stay within station spread */
|