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

Function SetViewportWaypointRect

src/viewport.cpp:3782–3797  ·  view source on GitHub ↗

* Select or deselect waypoint for rectangle 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

3780 * @param sel Select or deselect given waypoint
3781 */
3782void SetViewportWaypointRect(const Waypoint *wp, bool sel)
3783{
3784 SetWindowDirtyForViewportCatchment();
3785 /* Mark tiles dirty for redrawing and update selected waypoint if a different waypoint is already highlighted. */
3786 if (sel && _viewport_highlight_waypoint_rect != wp) {
3787 ClearViewportCatchment();
3788 _viewport_highlight_waypoint_rect = wp;
3789 MarkCatchmentTilesDirty();
3790 /* Mark tiles dirty for redrawing and clear waypoint selection if deselecting highlight. */
3791 } else if (!sel && _viewport_highlight_waypoint_rect == wp) {
3792 MarkCatchmentTilesDirty();
3793 _viewport_highlight_waypoint_rect = nullptr;
3794 }
3795 /* Redraw the currently selected waypoint window */
3796 if (_viewport_highlight_waypoint_rect != nullptr) SetWindowDirty(WC_WAYPOINT_VIEW, _viewport_highlight_waypoint_rect->index);
3797}
3798
3799/**
3800 * Select or deselect town for coverage area highlight.

Callers 5

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

Calls 4

ClearViewportCatchmentFunction · 0.85
MarkCatchmentTilesDirtyFunction · 0.85
SetWindowDirtyFunction · 0.85

Tested by

no test coverage detected