1
0
Fork 0

Change: Disable service interval widgets for non-owned vehicles

pull/13260/head
glx22 2025-01-03 18:57:10 +01:00
parent 59a45cc852
commit b988b48997
1 changed files with 3 additions and 0 deletions

View File

@ -2596,6 +2596,8 @@ struct VehicleDetailsWindow : Window {
/** Checks whether service interval is enabled for the vehicle. */
static bool IsVehicleServiceIntervalEnabled(const VehicleType vehicle_type, CompanyID company_id)
{
if (_local_company != company_id) return false;
const VehicleDefaultSettings *vds = &Company::Get(company_id)->settings.vehicle;
switch (vehicle_type) {
default: NOT_REACHED();
@ -2767,6 +2769,7 @@ struct VehicleDetailsWindow : Window {
v->ServiceIntervalIsPercent() ? STR_VEHICLE_DETAILS_PERCENT :
TimerGameEconomy::UsingWallclockUnits() ? STR_VEHICLE_DETAILS_MINUTES : STR_VEHICLE_DETAILS_DAYS;
this->GetWidget<NWidgetCore>(WID_VD_SERVICE_INTERVAL_DROPDOWN)->SetString(str);
this->SetWidgetDisabledState(WID_VD_SERVICE_INTERVAL_DROPDOWN, v->owner != _local_company);
this->DrawWidgets();
}