1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-23 20:24:12 +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

@@ -388,7 +388,7 @@ private:
}
public:
VehicleGroupWindow(WindowDesc *desc, WindowNumber window_number) : BaseVehicleListWindow(desc, window_number)
VehicleGroupWindow(WindowDesc &desc, WindowNumber window_number) : BaseVehicleListWindow(desc, window_number)
{
this->CreateNestedTree();
@@ -1170,10 +1170,10 @@ void ShowCompanyGroup(CompanyID company, VehicleType vehicle_type, GroupID group
const WindowNumber num = VehicleListIdentifier(VL_GROUP_LIST, vehicle_type, company).Pack();
VehicleGroupWindow *w;
if (vehicle_type == VEH_TRAIN) {
w = AllocateWindowDescFront<VehicleGroupWindow>(&_train_group_desc, num, need_existing_window);
w = AllocateWindowDescFront<VehicleGroupWindow>(_train_group_desc, num, need_existing_window);
} else {
_other_group_desc.cls = GetWindowClassForVehicleType(vehicle_type);
w = AllocateWindowDescFront<VehicleGroupWindow>(&_other_group_desc, num, need_existing_window);
w = AllocateWindowDescFront<VehicleGroupWindow>(_other_group_desc, num, need_existing_window);
}
if (w != nullptr) w->SelectGroup(group);
}