mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-06-22 21:19:27 +01:00
Codechange: add helpers to VehicleListIdentifier for ConvertibleThroughBase
This commit is contained in:
parent
f60b3d7f79
commit
6535fc1f80
@ -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();
|
||||
}
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user