(svn r24260) -Change [FS#5126]: Make the oilrig-vehicle list accessible to specators and colour it's caption neutrally grey.

This commit is contained in:
frosch
2012-05-16 22:08:46 +00:00
parent c94a2d5289
commit db09f67674
3 changed files with 12 additions and 18 deletions

View File

@@ -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);