Fix: Draw unavailable mask over picker sprite instead of behind it.

This makes these disabled picker buttons consistent with other disabled buttons.
wip-string
Peter Nelson 6 months ago committed by Peter Nelson
parent 712a4bb40b
commit 7466c3c39e

@ -358,9 +358,6 @@ public:
const ObjectSpec *spec = objclass->GetSpec(obj_index);
if (spec == nullptr) break;
if (!spec->IsAvailable()) {
GfxFillRect(r.Shrink(WidgetDimensions::scaled.bevel), PC_BLACK, FILLRECT_CHECKER);
}
DrawPixelInfo tmp_dpi;
/* Set up a clipping area for the preview. */
Rect ir = r.Shrink(WidgetDimensions::scaled.bevel);
@ -375,6 +372,9 @@ public:
std::min<int>(_selected_object_view, spec->views - 1));
}
}
if (!spec->IsAvailable()) {
GfxFillRect(ir, PC_BLACK, FILLRECT_CHECKER);
}
break;
}

@ -1289,9 +1289,6 @@ public:
assert(type < _railstation.station_count);
/* Check station availability callback */
const StationSpec *statspec = StationClass::Get(_railstation.station_class)->GetSpec(type);
if (!IsStationAvailable(statspec)) {
GfxFillRect(r.Shrink(WidgetDimensions::scaled.bevel), PC_BLACK, FILLRECT_CHECKER);
}
/* Set up a clipping area for the station preview. */
Rect ir = r.Shrink(WidgetDimensions::scaled.bevel);
@ -1303,6 +1300,9 @@ public:
StationPickerDrawSprite(x, y, STATION_RAIL, _cur_railtype, INVALID_ROADTYPE, 2 + _railstation.orientation);
}
}
if (!IsStationAvailable(statspec)) {
GfxFillRect(ir, PC_BLACK, FILLRECT_CHECKER);
}
break;
}
}
@ -2110,7 +2110,7 @@ struct BuildRailWaypointWindow : PickerWindowBase {
}
if (!IsStationAvailable(statspec)) {
GfxFillRect(r.Shrink(WidgetDimensions::scaled.bevel), PC_BLACK, FILLRECT_CHECKER);
GfxFillRect(ir, PC_BLACK, FILLRECT_CHECKER);
}
}
}

@ -1425,11 +1425,11 @@ public:
int y = (ir.Height() + ScaleSpriteTrad(48)) / 2 - ScaleSpriteTrad(31);
if (spec == nullptr || disabled) {
StationPickerDrawSprite(x, y, st, INVALID_RAILTYPE, _cur_roadtype, widget - WID_BROS_STATION_NE);
if (disabled) GfxFillRect(0, 0, ir.Width(), ir.Height(), PC_BLACK, FILLRECT_CHECKER);
} else {
DrawRoadStopTile(x, y, _cur_roadtype, spec, st, widget - WID_BROS_STATION_NE);
}
}
if (disabled) GfxFillRect(ir, PC_BLACK, FILLRECT_CHECKER);
break;
}
@ -1455,10 +1455,6 @@ public:
const RoadStopSpec *spec = RoadStopClass::Get(_roadstop_gui_settings.roadstop_class)->GetSpec(type);
StationType st = GetRoadStationTypeByWindowClass(this->window_class);
if (!IsRoadStopAvailable(spec, st)) {
GfxFillRect(r.Shrink(WidgetDimensions::scaled.bevel), PC_BLACK, FILLRECT_CHECKER);
}
/* Set up a clipping area for the sprite preview. */
DrawPixelInfo tmp_dpi;
Rect ir = r.Shrink(WidgetDimensions::scaled.bevel);
@ -1474,6 +1470,9 @@ public:
DrawRoadStopTile(x, y, _cur_roadtype, spec, st, (uint8_t)orientation);
}
}
if (!IsRoadStopAvailable(spec, st)) {
GfxFillRect(ir, PC_BLACK, FILLRECT_CHECKER);
}
break;
}
}

Loading…
Cancel
Save