mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-12 18:40:29 +00:00
(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:
parent
c94a2d5289
commit
db09f67674
@ -854,8 +854,6 @@ struct StationViewWindow : public Window {
|
||||
~StationViewWindow()
|
||||
{
|
||||
Owner owner = Station::Get(this->window_number)->owner;
|
||||
if (!Company::IsValidID(owner)) owner = _local_company;
|
||||
if (!Company::IsValidID(owner)) return; // Spectators
|
||||
DeleteWindowById(WC_TRAINS_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_TRAIN, owner, this->window_number).Pack(), false);
|
||||
DeleteWindowById(WC_ROADVEH_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_ROAD, owner, this->window_number).Pack(), false);
|
||||
DeleteWindowById(WC_SHIPS_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_SHIP, owner, this->window_number).Pack(), false);
|
||||
@ -1162,9 +1160,11 @@ struct StationViewWindow : public Window {
|
||||
case WID_SV_TRAINS: // Show list of scheduled trains to this station
|
||||
case WID_SV_ROADVEHS: // Show list of scheduled road-vehicles to this station
|
||||
case WID_SV_SHIPS: // Show list of scheduled ships to this station
|
||||
case WID_SV_PLANES: // Show list of scheduled aircraft to this station
|
||||
ShowVehicleListWindow(this->owner, (VehicleType)(widget - WID_SV_TRAINS), (StationID)this->window_number);
|
||||
case WID_SV_PLANES: { // Show list of scheduled aircraft to this station
|
||||
Owner owner = Station::Get(this->window_number)->owner;
|
||||
ShowVehicleListWindow(owner, (VehicleType)(widget - WID_SV_TRAINS), (StationID)this->window_number);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1358,7 +1358,7 @@ public:
|
||||
}
|
||||
|
||||
this->FinishInitNested(desc, window_number);
|
||||
this->owner = this->vli.company;
|
||||
if (this->vli.company != OWNER_NONE) this->owner = this->vli.company;
|
||||
|
||||
if (this->vli.vtype == VEH_TRAIN) ResizeWindow(this, 65, 0);
|
||||
}
|
||||
@ -1609,7 +1609,7 @@ static WindowDesc _vehicle_list_desc(
|
||||
|
||||
static void ShowVehicleListWindowLocal(CompanyID company, VehicleListType vlt, VehicleType vehicle_type, uint16 unique_number)
|
||||
{
|
||||
if (!Company::IsValidID(company)) return;
|
||||
if (!Company::IsValidID(company) && company != OWNER_NONE) return;
|
||||
|
||||
_vehicle_list_desc.cls = GetWindowClassForVehicleType(vehicle_type);
|
||||
AllocateWindowDescFront<VehicleListWindow>(&_vehicle_list_desc, VehicleListIdentifier(vlt, vehicle_type, company, unique_number).Pack());
|
||||
@ -1636,15 +1636,7 @@ void ShowVehicleListWindow(const Vehicle *v)
|
||||
|
||||
void ShowVehicleListWindow(CompanyID company, VehicleType vehicle_type, StationID station)
|
||||
{
|
||||
if (!Company::IsValidID(company)) {
|
||||
company = _local_company;
|
||||
/* This can happen when opening the vehicle list as a spectator. */
|
||||
if (!Company::IsValidID(company)) return;
|
||||
_vehicle_list_desc.flags |= WDF_CONSTRUCTION;
|
||||
} else {
|
||||
_vehicle_list_desc.flags &= ~WDF_CONSTRUCTION;
|
||||
}
|
||||
|
||||
_vehicle_list_desc.flags &= ~WDF_CONSTRUCTION;
|
||||
ShowVehicleListWindowLocal(company, VL_STATION_LIST, vehicle_type, station);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user