1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-31 02:19:09 +00:00

Change: Disable service interval widgets for non-owned vehicles (#13260)

This commit is contained in:
Loïc Guilloux
2025-01-03 19:38:45 +01:00
committed by GitHub
parent 59a45cc852
commit cb18cb5832

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();
}