|
@@ -1166,41 +1166,41 @@ struct BuildVehicleWindow : Window {
|
|
|
case BUILD_VEHICLE_WIDGET_CARGO_FILTER_DROPDOWN: // Select a cargo filter criteria
|
|
|
if (this->cargo_filter_criteria != index) {
|
|
|
this->cargo_filter_criteria = index;
|
|
|
_last_filter_criteria[this->vehicle_type] = this->cargo_filter_criteria;
|
|
|
/* deactivate filter if criteria is 'Show All', activate it otherwise */
|
|
|
this->eng_list.SetFilterState(this->cargo_filter[this->cargo_filter_criteria] != CF_ANY);
|
|
|
this->eng_list.ForceRebuild();
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
this->SetDirty();
|
|
|
}
|
|
|
|
|
|
virtual void OnResize()
|
|
|
{
|
|
|
this->vscroll.SetCapacity((this->GetWidget<NWidgetCore>(BUILD_VEHICLE_WIDGET_LIST)->current_y) / this->resize.step_height);
|
|
|
this->GetWidget<NWidgetCore>(BUILD_VEHICLE_WIDGET_LIST)->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
|
|
|
}
|
|
|
};
|
|
|
|
|
|
static const WindowDesc _build_vehicle_desc(
|
|
|
WDP_AUTO, WDP_AUTO, 240, 186, 240, 268,
|
|
|
WC_BUILD_VEHICLE, WC_NONE,
|
|
|
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE | WDF_CONSTRUCTION,
|
|
|
NULL, _nested_build_vehicle_widgets, lengthof(_nested_build_vehicle_widgets)
|
|
|
_nested_build_vehicle_widgets, lengthof(_nested_build_vehicle_widgets)
|
|
|
);
|
|
|
|
|
|
void ShowBuildVehicleWindow(TileIndex tile, VehicleType type)
|
|
|
{
|
|
|
/* We want to be able to open both Available Train as Available Ships,
|
|
|
* so if tile == INVALID_TILE (Available XXX Window), use 'type' as unique number.
|
|
|
* As it always is a low value, it won't collide with any real tile
|
|
|
* number. */
|
|
|
uint num = (tile == INVALID_TILE) ? (int)type : tile;
|
|
|
|
|
|
assert(IsCompanyBuildableVehicleType(type));
|
|
|
|
|
|
DeleteWindowById(WC_BUILD_VEHICLE, num);
|
|
|
|
|
|
new BuildVehicleWindow(&_build_vehicle_desc, tile, type);
|
|
|
}
|