Merge branch 'master' into enhanced_viewport_overlay
Notes on conflict resolution: * MarkTileDirtyByTile gained an extra param on both sides of the merge Move bridge level offset to be after zoom level param, as it's used less. * Add zoom level params to MarkBridgeDirty functions * Fix undefined behaviour in colour_index cycling in ViewportMapDraw Conflicts: src/clear_cmd.cpp src/pbs.cpp src/rail_cmd.cpp src/toolbar_gui.cpp src/train_cmd.cpp src/vehicle.cpp src/viewport.cpp src/viewport_func.h
This commit is contained in:
@@ -434,6 +434,18 @@ struct BuildRailToolbarWindow : Window {
|
||||
if (_settings_client.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Some data on this window has become invalid.
|
||||
* @param data Information about the changed data.
|
||||
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
|
||||
*/
|
||||
virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
|
||||
{
|
||||
if (!gui_scope) return;
|
||||
|
||||
if (!CanBuildVehicleInfrastructure(VEH_TRAIN)) delete this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the rail toolbar for railtype given
|
||||
* @param railtype the railtype to display
|
||||
@@ -1075,8 +1087,8 @@ public:
|
||||
case WID_BRAS_PLATFORM_DIR_X:
|
||||
case WID_BRAS_PLATFORM_DIR_Y:
|
||||
case WID_BRAS_IMAGE:
|
||||
size->width = UnScaleByZoom(64 * 4, ZOOM_LVL_GUI) + 2;
|
||||
size->height = UnScaleByZoom(58 * 4, ZOOM_LVL_GUI) + 2;
|
||||
size->width = ScaleGUITrad(64) + 2;
|
||||
size->height = ScaleGUITrad(58) + 2;
|
||||
break;
|
||||
|
||||
case WID_BRAS_COVERAGE_TEXTS:
|
||||
@@ -1100,8 +1112,8 @@ public:
|
||||
if (FillDrawPixelInfo(&tmp_dpi, r.left, r.top, r.right - r.left + 1, r.bottom - r.top + 1)) {
|
||||
DrawPixelInfo *old_dpi = _cur_dpi;
|
||||
_cur_dpi = &tmp_dpi;
|
||||
int x = UnScaleByZoom(31 * 4, ZOOM_LVL_GUI) + 1;
|
||||
int y = r.bottom - r.top - UnScaleByZoom(31 * 4, ZOOM_LVL_GUI);
|
||||
int x = ScaleGUITrad(31) + 1;
|
||||
int y = r.bottom - r.top - ScaleGUITrad(31);
|
||||
if (!DrawStationTile(x, y, _cur_railtype, AXIS_X, _railstation.station_class, _railstation.station_type)) {
|
||||
StationPickerDrawSprite(x, y, STATION_RAIL, _cur_railtype, INVALID_ROADTYPE, 2);
|
||||
}
|
||||
@@ -1114,8 +1126,8 @@ public:
|
||||
if (FillDrawPixelInfo(&tmp_dpi, r.left, r.top, r.right - r.left + 1, r.bottom - r.top + 1)) {
|
||||
DrawPixelInfo *old_dpi = _cur_dpi;
|
||||
_cur_dpi = &tmp_dpi;
|
||||
int x = UnScaleByZoom(31 * 4, ZOOM_LVL_GUI) + 1;
|
||||
int y = r.bottom - r.top - UnScaleByZoom(31 * 4, ZOOM_LVL_GUI);
|
||||
int x = ScaleGUITrad(31) + 1;
|
||||
int y = r.bottom - r.top - ScaleGUITrad(31);
|
||||
if (!DrawStationTile(x, y, _cur_railtype, AXIS_Y, _railstation.station_class, _railstation.station_type)) {
|
||||
StationPickerDrawSprite(x, y, STATION_RAIL, _cur_railtype, INVALID_ROADTYPE, 3);
|
||||
}
|
||||
@@ -1152,8 +1164,8 @@ public:
|
||||
if (FillDrawPixelInfo(&tmp_dpi, r.left, r.top, r.right - r.left + 1, r.bottom - r.top + 1)) {
|
||||
DrawPixelInfo *old_dpi = _cur_dpi;
|
||||
_cur_dpi = &tmp_dpi;
|
||||
int x = UnScaleByZoom(31 * 4, ZOOM_LVL_GUI) + 1;
|
||||
int y = r.bottom - r.top - UnScaleByZoom(31 * 4, ZOOM_LVL_GUI);
|
||||
int x = ScaleGUITrad(31) + 1;
|
||||
int y = r.bottom - r.top - ScaleGUITrad(31);
|
||||
if (!DrawStationTile(x, y, _cur_railtype, _railstation.orientation, _railstation.station_class, type)) {
|
||||
StationPickerDrawSprite(x, y, STATION_RAIL, _cur_railtype, INVALID_ROADTYPE, 2 + _railstation.orientation);
|
||||
}
|
||||
@@ -1693,15 +1705,15 @@ struct BuildRailDepotWindow : public PickerWindowBase {
|
||||
{
|
||||
if (!IsInsideMM(widget, WID_BRAD_DEPOT_NE, WID_BRAD_DEPOT_NW + 1)) return;
|
||||
|
||||
size->width = UnScaleByZoom(64 * 4, ZOOM_LVL_GUI) + 2;
|
||||
size->height = UnScaleByZoom(48 * 4, ZOOM_LVL_GUI) + 2;
|
||||
size->width = ScaleGUITrad(64) + 2;
|
||||
size->height = ScaleGUITrad(48) + 2;
|
||||
}
|
||||
|
||||
virtual void DrawWidget(const Rect &r, int widget) const
|
||||
{
|
||||
if (!IsInsideMM(widget, WID_BRAD_DEPOT_NE, WID_BRAD_DEPOT_NW + 1)) return;
|
||||
|
||||
DrawTrainDepotSprite(r.left + 1 + UnScaleByZoom(31 * 4, ZOOM_LVL_GUI), r.bottom - UnScaleByZoom(31 * 4, ZOOM_LVL_GUI), widget - WID_BRAD_DEPOT_NE + DIAGDIR_NE, _cur_railtype);
|
||||
DrawTrainDepotSprite(r.left + 1 + ScaleGUITrad(31), r.bottom - ScaleGUITrad(31), widget - WID_BRAD_DEPOT_NE + DIAGDIR_NE, _cur_railtype);
|
||||
}
|
||||
|
||||
virtual void OnClick(Point pt, int widget, int click_count)
|
||||
@@ -1791,8 +1803,8 @@ struct BuildRailWaypointWindow : PickerWindowBase {
|
||||
break;
|
||||
|
||||
case WID_BRW_WAYPOINT:
|
||||
size->width = UnScaleByZoom(64 * 4, ZOOM_LVL_GUI) + 2;
|
||||
size->height = UnScaleByZoom(58 * 4, ZOOM_LVL_GUI) + 2;
|
||||
size->width = ScaleGUITrad(64) + 2;
|
||||
size->height = ScaleGUITrad(58) + 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1803,7 +1815,7 @@ struct BuildRailWaypointWindow : PickerWindowBase {
|
||||
case WID_BRW_WAYPOINT: {
|
||||
byte type = GB(widget, 16, 16);
|
||||
const StationSpec *statspec = StationClass::Get(STAT_CLASS_WAYP)->GetSpec(type);
|
||||
DrawWaypointSprite(r.left + 1 + UnScaleByZoom(31 * 4, ZOOM_LVL_GUI), r.bottom - UnScaleByZoom(31 * 4, ZOOM_LVL_GUI), type, _cur_railtype);
|
||||
DrawWaypointSprite(r.left + 1 + ScaleGUITrad(31), r.bottom - ScaleGUITrad(31), type, _cur_railtype);
|
||||
|
||||
if (!IsStationAvailable(statspec)) {
|
||||
GfxFillRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, PC_BLACK, FILLRECT_CHECKER);
|
||||
|
Reference in New Issue
Block a user