diff options
Diffstat (limited to 'src/vehiclelist.cpp')
-rw-r--r-- | src/vehiclelist.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/vehiclelist.cpp b/src/vehiclelist.cpp index 7e42b25aa..f1f5d0424 100644 --- a/src/vehiclelist.cpp +++ b/src/vehiclelist.cpp @@ -37,7 +37,7 @@ uint32 VehicleListIdentifier::Pack() const * @param data The data to unpack. * @return true iff the data was valid (enough). */ -bool VehicleListIdentifier::Unpack(uint32 data) +bool VehicleListIdentifier::UnpackIfValid(uint32 data) { byte c = GB(data, 28, 4); this->company = c == 0xF ? OWNER_NONE : (CompanyID)c; @@ -52,10 +52,12 @@ bool VehicleListIdentifier::Unpack(uint32 data) * Decode a packed vehicle list identifier into a new one. * @param data The data to unpack. */ -VehicleListIdentifier::VehicleListIdentifier(uint32 data) +/* static */ VehicleListIdentifier VehicleListIdentifier::UnPack(uint32 data) { - bool ret = this->Unpack(data); + VehicleListIdentifier result; + bool ret = result.UnpackIfValid(data); assert(ret); + return result; } /** |