summaryrefslogtreecommitdiff
path: root/src/vehiclelist.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2012-05-16 22:08:46 +0000
committerfrosch <frosch@openttd.org>2012-05-16 22:08:46 +0000
commitdb09f6767465aebe8e90bbe8dd65aa50aafcbc94 (patch)
tree4efa361cae2e7ddc074b5c04de63b6e0b37d274b /src/vehiclelist.cpp
parentc94a2d52896964f16f3f972c115bbb687861ab1c (diff)
downloadopenttd-db09f6767465aebe8e90bbe8dd65aa50aafcbc94.tar.xz
(svn r24260) -Change [FS#5126]: Make the oilrig-vehicle list accessible to specators and colour it's caption neutrally grey.
Diffstat (limited to 'src/vehiclelist.cpp')
-rw-r--r--src/vehiclelist.cpp8
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);