From 2e7545f85f809fac7ec271e18aaeeac2fb4b3574 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Sun, 19 Mar 2023 11:01:17 +0000 Subject: [PATCH] Road stops: Add flag to use custom graphics for disabled views in build window --- docs/newgrf-roadstops-nml.html | 2 ++ docs/newgrf-roadstops.html | 1 + src/newgrf_roadstop.h | 1 + src/road_gui.cpp | 4 ++-- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/newgrf-roadstops-nml.html b/docs/newgrf-roadstops-nml.html index 2738eb0e9b..55fa86572b 100644 --- a/docs/newgrf-roadstops-nml.html +++ b/docs/newgrf-roadstops-nml.html @@ -91,6 +91,8 @@ Only show in the road build menu (not tram). (This only takes effect from road_stops version 4).

RST_GENERAL_FLAG_BUILD_MENU_TRAM_ONLY
Only show in the tram build menu (not road). (This only takes effect from road_stops version 4).

+

RST_GENERAL_FLAG_BUILD_MENU_DRAW_DISABLED_VIEWS
+ Use custom graphics for disabled road stop views. (This only takes effect from road_stops version 8).

minimum_bridge_heightArray of 6 items [0..255, ...]Minimum clearances required for a bridge for each of the 6 views/rotations (or 0 to not allow any bridge). Values are given in height level units (1 level == 8px). disallowed_bridge_pillarsArray of 6 items [bitmask(RST_BRIDGE_PILLAR_FLAG_, ...), ...] diff --git a/docs/newgrf-roadstops.html b/docs/newgrf-roadstops.html index 25d1eeb5d9..5e7f71ccf6 100644 --- a/docs/newgrf-roadstops.html +++ b/docs/newgrf-roadstops.html @@ -158,6 +158,7 @@ 410Do not automatically build connecting road pieces.
This requires road_stops, version 3. 520Only show in the road build menu (not tram).
This requires road_stops, version 4. 640Only show in the tram build menu (not road).
This requires road_stops, version 4. + 780Use custom graphics for disabled road stop views.
This requires road_stops, version 8. The default value is 0 (no flags enabled).

diff --git a/src/newgrf_roadstop.h b/src/newgrf_roadstop.h index 90bb1bc15d..aab86a5cdb 100644 --- a/src/newgrf_roadstop.h +++ b/src/newgrf_roadstop.h @@ -71,6 +71,7 @@ enum RoadStopSpecFlags { RSF_NO_AUTO_ROAD_CONNECTION, ///< No auto road connection. RSF_BUILD_MENU_ROAD_ONLY, ///< Only show in the road build menu (not tram). RSF_BUILD_MENU_TRAM_ONLY, ///< Only show in the tram build menu (not road). + RSF_BUILD_MENU_DRAW_DISABLED_VIEWS, ///< Use custom road stop graphics for disabled views }; enum RoadStopSpecIntlFlags { diff --git a/src/road_gui.cpp b/src/road_gui.cpp index 14de1ff363..e217943f56 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -1570,12 +1570,12 @@ public: int x = (r.Width() - ScaleSpriteTrad(64)) / 2 + ScaleSpriteTrad(31); int y = (r.Height() + ScaleSpriteTrad(48)) / 2 - ScaleSpriteTrad(31); if (spec != nullptr && spec->height > 2) y += (spec->height - 2) * ScaleSpriteTrad(4); - if (spec == nullptr || disabled) { + if (spec == nullptr || (disabled && !HasBit(spec->flags, RSF_BUILD_MENU_DRAW_DISABLED_VIEWS))) { StationPickerDrawSprite(x, y, st, INVALID_RAILTYPE, _cur_roadtype, widget - WID_BROS_STATION_NE); - if (disabled) GfxFillRect(1, 1, r.Width() - 1, r.Height() - 1, PC_BLACK, FILLRECT_CHECKER); } else { DrawRoadStopTile(x, y, _cur_roadtype, spec, st, widget - WID_BROS_STATION_NE); } + if (disabled) GfxFillRect(1, 1, r.Width() - 1, r.Height() - 1, PC_BLACK, FILLRECT_CHECKER); } break; }