diff options
author | PeterN <peter@fuzzle.org> | 2019-04-20 17:49:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-20 17:49:54 +0100 |
commit | c17736b493bccad5aeb51fd3b490d79ec7b60a7a (patch) | |
tree | ccd963dbc8c2d669783e3b43d1c6e34d8b96a37b /src | |
parent | be073b46daa9b70102e6299588f43454a35e46cf (diff) | |
download | openttd-c17736b493bccad5aeb51fd3b490d79ec7b60a7a.tar.xz |
Fix e8d397e: Invisible station/waypoint signs could still be clicked on. (#7531)
Diffstat (limited to 'src')
-rw-r--r-- | src/viewport.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/viewport.cpp b/src/viewport.cpp index 804aa1cc6..b3865f763 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -1999,15 +1999,17 @@ static bool CheckClickOnViewportSign(const ViewPort *vp, int x, int y, const Vie */ static bool CheckClickOnViewportSign(const ViewPort *vp, int x, int y) { + if (_game_mode == GM_MENU) return false; + x = ScaleByZoom(x - vp->left, vp->zoom) + vp->virtual_left; y = ScaleByZoom(y - vp->top, vp->zoom) + vp->virtual_top; Rect search_rect{ x - 1, y - 1, x + 1, y + 1 }; search_rect = ExpandRectWithViewportSignMargins(search_rect, vp->zoom); - bool show_stations = HasBit(_display_opt, DO_SHOW_STATION_NAMES) && _game_mode != GM_MENU; - bool show_waypoints = HasBit(_display_opt, DO_SHOW_WAYPOINT_NAMES) && _game_mode != GM_MENU; - bool show_towns = HasBit(_display_opt, DO_SHOW_TOWN_NAMES) && _game_mode != GM_MENU; + bool show_stations = HasBit(_display_opt, DO_SHOW_STATION_NAMES) && !IsInvisibilitySet(TO_SIGNS); + bool show_waypoints = HasBit(_display_opt, DO_SHOW_WAYPOINT_NAMES) && !IsInvisibilitySet(TO_SIGNS); + bool show_towns = HasBit(_display_opt, DO_SHOW_TOWN_NAMES); bool show_signs = HasBit(_display_opt, DO_SHOW_SIGNS) && !IsInvisibilitySet(TO_SIGNS); bool show_competitors = HasBit(_display_opt, DO_SHOW_COMPETITOR_SIGNS); |