Road stops: Add flag to use custom graphics for disabled views in build window

This commit is contained in:
Jonathan G Rennison 2023-03-19 11:01:17 +00:00
parent ec73775f97
commit 2e7545f85f
4 changed files with 6 additions and 2 deletions

View File

@ -91,6 +91,8 @@
<span class="indent">Only show in the road build menu (not tram). (This only takes effect from <span class="code">road_stops</span> version 4).</span></p>
<p><b>RST_GENERAL_FLAG_BUILD_MENU_TRAM_ONLY</b><br />
<span class="indent">Only show in the tram build menu (not road). (This only takes effect from <span class="code">road_stops</span> version 4).</span></p>
<p><b>RST_GENERAL_FLAG_BUILD_MENU_DRAW_DISABLED_VIEWS</b><br />
<span class="indent">Use custom graphics for disabled road stop views. (This only takes effect from <span class="code">road_stops</span> version 8).</span></p>
</td></tr>
<tr><td>minimum_bridge_height</td><td>Array of 6 items [0..255, ...]</td><td>Minimum clearances required for a bridge for each of the <a href="#roadstop_views">6 views/rotations</a> (or 0 to not allow any bridge). Values are given in height level units (1 level == 8px).</td></tr>
<tr><td>disallowed_bridge_pillars</td><td>Array of 6 items [bitmask(RST_BRIDGE_PILLAR_FLAG_, ...), ...]</td><td>

View File

@ -158,6 +158,7 @@
<tr><td>4</td><td>10</td><td>Do not automatically build connecting road pieces.</br>This requires <font face="monospace">road_stops</font>, version 3.</td></tr>
<tr><td>5</td><td>20</td><td>Only show in the road build menu (not tram).</br>This requires <font face="monospace">road_stops</font>, version 4.</td></tr>
<tr><td>6</td><td>40</td><td>Only show in the tram build menu (not road).</br>This requires <font face="monospace">road_stops</font>, version 4.</td></tr>
<tr><td>7</td><td>80</td><td>Use custom graphics for disabled road stop views.</br>This requires <font face="monospace">road_stops</font>, version 8.</td></tr>
</table>
The default value is 0 (no flags enabled).
</p>

View File

@ -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 {

View File

@ -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;
}