1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-02-03 18:08:14 +01:00

Codechange: Pass WindowDesc by reference instead of pointer. (#12771)

WindowDesc as passed to Windows is not optional so don't allow to it to be nullptr.
This commit is contained in:
Peter Nelson
2024-06-11 08:58:03 +01:00
committed by GitHub
parent 18bce69623
commit 4cf6d1dd79
68 changed files with 293 additions and 301 deletions

View File

@@ -100,7 +100,7 @@ static TileIndex GetOtherAqueductEnd(TileIndex tile_from, TileIndex *tile_to = n
struct BuildDocksToolbarWindow : Window {
DockToolbarWidgets last_clicked_widget; ///< Contains the last widget that has been clicked on this toolbar.
BuildDocksToolbarWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc)
BuildDocksToolbarWindow(WindowDesc &desc, WindowNumber window_number) : Window(desc)
{
this->last_clicked_widget = WID_DT_INVALID;
this->InitNested(window_number);
@@ -364,7 +364,7 @@ Window *ShowBuildDocksToolbar()
if (!Company::IsValidID(_local_company)) return nullptr;
CloseWindowByClass(WC_BUILD_TOOLBAR);
return AllocateWindowDescFront<BuildDocksToolbarWindow>(&_build_docks_toolbar_desc, TRANSPORT_WATER);
return AllocateWindowDescFront<BuildDocksToolbarWindow>(_build_docks_toolbar_desc, TRANSPORT_WATER);
}
/**
@@ -402,7 +402,7 @@ static WindowDesc _build_docks_scen_toolbar_desc(
*/
Window *ShowBuildDocksScenToolbar()
{
return AllocateWindowDescFront<BuildDocksToolbarWindow>(&_build_docks_scen_toolbar_desc, TRANSPORT_WATER);
return AllocateWindowDescFront<BuildDocksToolbarWindow>(_build_docks_scen_toolbar_desc, TRANSPORT_WATER);
}
/** Widget numbers of the build-dock GUI. */
@@ -416,7 +416,7 @@ enum BuildDockStationWidgets {
struct BuildDocksStationWindow : public PickerWindowBase {
public:
BuildDocksStationWindow(WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent)
BuildDocksStationWindow(WindowDesc &desc, Window *parent) : PickerWindowBase(desc, parent)
{
this->InitNested(TRANSPORT_WATER);
this->LowerWidget(_settings_client.gui.station_show_coverage + BDSW_LT_OFF);
@@ -507,7 +507,7 @@ static WindowDesc _build_dock_station_desc(
static void ShowBuildDockStationPicker(Window *parent)
{
new BuildDocksStationWindow(&_build_dock_station_desc, parent);
new BuildDocksStationWindow(_build_dock_station_desc, parent);
}
struct BuildDocksDepotWindow : public PickerWindowBase {
@@ -522,7 +522,7 @@ private:
}
public:
BuildDocksDepotWindow(WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent)
BuildDocksDepotWindow(WindowDesc &desc, Window *parent) : PickerWindowBase(desc, parent)
{
this->InitNested(TRANSPORT_WATER);
this->LowerWidget(WID_BDD_X + _ship_depot_direction);
@@ -603,7 +603,7 @@ static WindowDesc _build_docks_depot_desc(
static void ShowBuildDocksDepotPicker(Window *parent)
{
new BuildDocksDepotWindow(&_build_docks_depot_desc, parent);
new BuildDocksDepotWindow(_build_docks_depot_desc, parent);
}