diff options
author | frosch <frosch@openttd.org> | 2016-11-05 19:16:59 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2016-11-05 19:16:59 +0000 |
commit | 476b2b0e8ca97807c2ffa0bb56ca7afcb5371a3b (patch) | |
tree | 5e30db10c875d4b9e7979618ff76f1a24bff0a3e /src/vehiclelist.cpp | |
parent | d9bfe88261b99631322ca348e48027e22fa3c84e (diff) | |
download | openttd-476b2b0e8ca97807c2ffa0bb56ca7afcb5371a3b.tar.xz |
(svn r27677) -Codechange: Remove implicit VehicleListIdentifier from uint32 constructor, to make conversions more explicit.
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; } /** |