From 37f56fa324fbd175f3804ab817ca728461c0a491 Mon Sep 17 00:00:00 2001 From: darkvater Date: Sun, 16 Jan 2005 12:29:52 +0000 Subject: [PATCH] (svn r1538) -Feature: [988816] Disable servicing when breakdowns set to none (jaguar7) --- lang/english.txt | 3 ++- settings.c | 1 + settings_gui.c | 1 + variables.h | 1 + vehicle.c | 3 +++ 5 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lang/english.txt b/lang/english.txt index 75134a9778..a036eca511 100644 --- a/lang/english.txt +++ b/lang/english.txt @@ -1044,6 +1044,7 @@ STR_CONFIG_PATCHES_SERVINT_AIRCRAFT :{LTBLUE}Default service interval for air STR_CONFIG_PATCHES_SERVINT_AIRCRAFT_DISABLED :{LTBLUE}Default service interval for aircraft: {ORANGE}disabled STR_CONFIG_PATCHES_SERVINT_SHIPS :{LTBLUE}Default service interval for ships: {ORANGE}{STRING} days/% STR_CONFIG_PATCHES_SERVINT_SHIPS_DISABLED :{LTBLUE}Default service interval for ships: {ORANGE}disabled +STR_CONFIG_PATCHES_NOSERVICE :{LTBLUE}Disable servicing when breakdowns set to none: {ORANGE}{STRING} STR_CONFIG_PATCHES_COLORED_NEWS_DATE :{LTBLUE}Coloured news appears in: {ORANGE}{STRING} STR_CONFIG_PATCHES_STARTING_DATE :{LTBLUE}Starting date: {ORANGE}{STRING} @@ -2789,4 +2790,4 @@ STR_MAGLEV_VEHICLES :Maglev Vehicles ############ End of list of rail types -STR_TINY_BLACK :{BLACK}{TINYFONT}{COMMA16} \ No newline at end of file +STR_TINY_BLACK :{BLACK}{TINYFONT}{COMMA16} diff --git a/settings.c b/settings.c index 8d5b862948..10e68952ff 100644 --- a/settings.c +++ b/settings.c @@ -876,6 +876,7 @@ const SettingDesc patch_settings[] = { {"servint_roadveh", SDT_UINT16, (void*)150, &_patches.servint_roadveh, NULL}, {"servint_ships", SDT_UINT16, (void*)360, &_patches.servint_ships, NULL}, {"servint_aircraft", SDT_UINT16, (void*)100, &_patches.servint_aircraft, NULL}, + {"no_servicing_if_no_breakdowns", SDT_BOOL, (void*)0, &_patches.no_servicing_if_no_breakdowns, NULL}, {"new_pathfinding", SDT_BOOL, (void*)true, &_patches.new_pathfinding, NULL}, {"pf_maxlength", SDT_UINT16, (void*)512, &_patches.pf_maxlength, NULL}, diff --git a/settings_gui.c b/settings_gui.c index 4bae1e5821..cb7eb0eada 100644 --- a/settings_gui.c +++ b/settings_gui.c @@ -660,6 +660,7 @@ static const PatchEntry _patches_vehicles[] = { {PE_UINT16, PF_0ISDIS, STR_CONFIG_PATCHES_SERVINT_ROADVEH, "servint_roadveh", &_patches.servint_roadveh, 5,800, 5, &InValidateDetailsWindow}, {PE_UINT16, PF_0ISDIS, STR_CONFIG_PATCHES_SERVINT_AIRCRAFT, "servint_aircraft", &_patches.servint_aircraft, 5,800, 5, &InValidateDetailsWindow}, {PE_UINT16, PF_0ISDIS, STR_CONFIG_PATCHES_SERVINT_SHIPS, "servint_ships", &_patches.servint_ships, 5,800, 5, &InValidateDetailsWindow}, + {PE_BOOL, 0, STR_CONFIG_PATCHES_NOSERVICE, "no_servicing_if_no_breakdowns", &_patches.no_servicing_if_no_breakdowns, 0, 0, 0, NULL}, }; static const PatchEntry _patches_stations[] = { diff --git a/variables.h b/variables.h index a743e3dde2..2043269f5a 100644 --- a/variables.h +++ b/variables.h @@ -129,6 +129,7 @@ typedef struct Patches { bool always_small_airport; // always allow small airports bool realistic_acceleration; // realistic acceleration for trains bool invisible_trees; // don't show trees when buildings are transparent + bool no_servicing_if_no_breakdowns; // dont send vehicles to depot when breakdowns are disabled uint8 toolbar_pos; // position of toolbars, 0=left, 1=center, 2=right uint8 window_snap_radius; // Windows snap at each other if closer than this diff --git a/vehicle.c b/vehicle.c index 5696102304..dd4d0934ca 100644 --- a/vehicle.c +++ b/vehicle.c @@ -28,6 +28,9 @@ void VehicleServiceInDepot(Vehicle *v) bool VehicleNeedsService(const Vehicle *v) { + if (_patches.no_servicing_if_no_breakdowns && _opt.diff.vehicle_breakdowns == 0) + return false; + return _patches.servint_ispercent ? (v->reliability < _engines[v->engine_type].reliability * (100 - v->service_interval) / 100) : (v->date_of_last_service + v->service_interval < _date);