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 4fc0f9ff3..b099d7a84 100644 --- a/src/vehiclelist.cpp +++ b/src/vehiclelist.cpp @@ -19,12 +19,13 @@ */ uint32 VehicleListIdentifier::Pack() { - assert(this->company < (1 << 4)); + byte c = this->company == OWNER_NONE ? 0xF : (byte)this->company; + assert(c < (1 << 4)); assert(this->type < (1 << 3)); assert(this->vtype < (1 << 2)); assert(this->index < (1 << 20)); - return this->company << 28 | this->type << 23 | this->vtype << 26 | this->index; + return c << 28 | this->type << 23 | this->vtype << 26 | this->index; } /** @@ -34,7 +35,8 @@ uint32 VehicleListIdentifier::Pack() */ bool VehicleListIdentifier::Unpack(uint32 data) { - this->company = (CompanyID)GB(data, 28, 4); + byte 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); |