1
0
Fork 0

Codechange: remove unused Unpack from VehicleListIdentifier

pull/13445/head
Rubidium 2025-02-01 21:07:42 +01:00 committed by rubidium42
parent e36a9ceaf0
commit 6b7cb4ede3
3 changed files with 1 additions and 31 deletions

View File

@ -2205,7 +2205,7 @@ public:
break;
case WID_VL_MANAGE_VEHICLES_DROPDOWN: {
ShowDropDownList(this, this->BuildActionDropdownList(VehicleListIdentifier::UnPack(this->window_number).type == VL_STANDARD, false, true), 0, WID_VL_MANAGE_VEHICLES_DROPDOWN);
ShowDropDownList(this, this->BuildActionDropdownList(this->vli.type == VL_STANDARD, false, true), 0, WID_VL_MANAGE_VEHICLES_DROPDOWN);
break;
}

View File

@ -32,34 +32,6 @@ uint32_t VehicleListIdentifier::Pack() const
return c << 28 | this->type << 23 | this->vtype << 26 | this->index;
}
/**
* Unpack a VehicleListIdentifier from a single uint32.
* @param data The data to unpack.
* @return true iff the data was valid (enough).
*/
bool VehicleListIdentifier::UnpackIfValid(uint32_t data)
{
uint8_t c = GB(data, 28, 4);
this->company = c == 0xF ? OWNER_NONE : (CompanyID)c;
this->type = (VehicleListType)GB(data, 23, 3);
this->vtype = (VehicleType)GB(data, 26, 2);
this->index = GB(data, 0, 20);
return this->type < VLT_END;
}
/**
* Decode a packed vehicle list identifier into a new one.
* @param data The data to unpack.
*/
/* static */ VehicleListIdentifier VehicleListIdentifier::UnPack(uint32_t data)
{
VehicleListIdentifier result;
[[maybe_unused]] bool ret = result.UnpackIfValid(data);
assert(ret);
return result;
}
/** Data for building a depot vehicle list. */
struct BuildDepotVehicleListData
{

View File

@ -32,8 +32,6 @@ struct VehicleListIdentifier {
uint32_t index; ///< A vehicle list type specific index.
uint32_t Pack() const;
bool UnpackIfValid(uint32_t data);
static VehicleListIdentifier UnPack(uint32_t data);
bool Valid() const { return this->type < VLT_END; }