MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / SetViewportCatchmentWaypoint

Function SetViewportCatchmentWaypoint

src/viewport.cpp:3759–3774  ·  view source on GitHub ↗

* Select or deselect waypoint for coverage area highlight. * Selecting a waypoint will deselect a town. * @param *wp Waypoint in question * @param sel Select or deselect given waypoint */

Source from the content-addressed store, hash-verified

3757 * @param sel Select or deselect given waypoint
3758 */
3759void SetViewportCatchmentWaypoint(const Waypoint *wp, bool sel)
3760{
3761 SetWindowDirtyForViewportCatchment();
3762 /* Mark tiles dirty for redrawing and update selected waypoint if a different waypoint is already highlighted. */
3763 if (sel && _viewport_highlight_waypoint != wp) {
3764 ClearViewportCatchment();
3765 _viewport_highlight_waypoint = wp;
3766 MarkCatchmentTilesDirty();
3767 /* Mark tiles dirty for redrawing and clear waypoint selection if deselecting highlight. */
3768 } else if (!sel && _viewport_highlight_waypoint == wp) {
3769 MarkCatchmentTilesDirty();
3770 _viewport_highlight_waypoint = nullptr;
3771 }
3772 /* Redraw the currently selected waypoint window */
3773 if (_viewport_highlight_waypoint != nullptr) SetWindowDirty(WC_WAYPOINT_VIEW, _viewport_highlight_waypoint->index);
3774}
3775
3776/**
3777 * Select or deselect waypoint for rectangle area highlight.

Callers 6

CcMoveWaypointNameFunction · 0.85
CloseMethod · 0.85
OnPlaceObjectAbortMethod · 0.85
CloseMethod · 0.85
OnClickMethod · 0.85

Calls 4

ClearViewportCatchmentFunction · 0.85
MarkCatchmentTilesDirtyFunction · 0.85
SetWindowDirtyFunction · 0.85

Tested by

no test coverage detected