Add: station catchment area with ctrl+click

This commit is contained in:
chucky-n-ice
2024-06-05 19:19:13 +02:00
parent 349322cad0
commit c2dbe3923e
3 changed files with 13 additions and 0 deletions

View File

@@ -678,4 +678,15 @@ std::string GetStationCoverageProductionText(TileIndex tile, int w, int h, int r
return s.str();
}
/* enable/disable catchment area with ctrl+click on a station */
void ShowCatchmentByClick(StationID station)
{
if (_viewport_highlight_station != nullptr) {
if (_viewport_highlight_station == Station::Get(station))
SetViewportCatchmentStation(Station::Get(station), false);
else SetViewportCatchmentStation(Station::Get(station), true);
}
else SetViewportCatchmentStation(Station::Get(station), true);
}
} // namespace citymania

View File

@@ -39,6 +39,7 @@ void SelectStationToJoin(const Station *station);
void MarkCoverageHighlightDirty();
bool CheckRedrawStationCoverage();
void AbortStationPlacement();
void ShowCatchmentByClick(StationID station);
std::string GetStationCoverageProductionText(TileIndex tile, int w, int h, int rad, StationCoverageType sct);

View File

@@ -2202,6 +2202,7 @@ static WindowDesc _station_view_desc(__FILE__, __LINE__,
*/
void ShowStationViewWindow(StationID station)
{
if (_ctrl_pressed) citymania::ShowCatchmentByClick(station); else
AllocateWindowDescFront<StationViewWindow>(&_station_view_desc, station);
}