Changeset - r28312:af8ce606526d
[Not reviewed]
master
0 3 0
Peter Nelson - 6 months ago 2023-12-20 00:20:51
peter1138@openttd.org
Fix: Draw unavailable mask over picker sprite instead of behind it.

This makes these disabled picker buttons consistent with other disabled buttons.
3 files changed with 11 insertions and 12 deletions:
0 comments (0 inline, 0 general)
src/object_gui.cpp
Show inline comments
 
@@ -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;
 
			}
 

	
src/rail_gui.cpp
Show inline comments
 
@@ -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 : PickerW
 
				}
 

	
 
				if (!IsStationAvailable(statspec)) {
 
					GfxFillRect(r.Shrink(WidgetDimensions::scaled.bevel), PC_BLACK, FILLRECT_CHECKER);
 
					GfxFillRect(ir, PC_BLACK, FILLRECT_CHECKER);
 
				}
 
			}
 
		}
src/road_gui.cpp
Show inline comments
 
@@ -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;
 
			}
 
		}
0 comments (0 inline, 0 general)