diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp index 0384cf3f2f..7e7d645810 100644 --- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -299,7 +299,7 @@ struct DepotWindow : Window { void Close([[maybe_unused]] int data = 0) override { CloseWindowById(WC_BUILD_VEHICLE, this->window_number); - CloseWindowById(GetWindowClassForVehicleType(this->type), VehicleListIdentifier(VL_DEPOT_LIST, this->type, this->owner, this->GetDestinationIndex().base()).ToWindowNumber(), false); + CloseWindowById(GetWindowClassForVehicleType(this->type), VehicleListIdentifier(VL_DEPOT_LIST, this->type, this->owner, this->GetDestinationIndex()).ToWindowNumber(), false); OrderBackup::Reset(TileIndex(this->window_number)); this->Window::Close(); } diff --git a/src/vehiclelist.h b/src/vehiclelist.h index b444dfd651..c316e30fc0 100644 --- a/src/vehiclelist.h +++ b/src/vehiclelist.h @@ -46,6 +46,7 @@ struct VehicleListIdentifier { constexpr VehicleID ToVehicleID() const { assert(this->type == VL_SHARED_ORDERS); return VehicleID(this->index); } constexpr void SetIndex(uint32_t index) { this->index = index; } + constexpr void SetIndex(ConvertibleThroughBase auto index) { this->index = index.base(); } /** * Create a simple vehicle list. @@ -57,6 +58,9 @@ struct VehicleListIdentifier { VehicleListIdentifier(VehicleListType type, VehicleType vtype, CompanyID company, uint index = 0) : type(type), vtype(vtype), company(company), index(index) {} + VehicleListIdentifier(VehicleListType type, VehicleType vtype, CompanyID company, ConvertibleThroughBase auto index) : + type(type), vtype(vtype), company(company), index(index.base()) {} + VehicleListIdentifier() = default; };