summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordarkvater <darkvater@openttd.org>2005-01-16 12:29:52 +0000
committerdarkvater <darkvater@openttd.org>2005-01-16 12:29:52 +0000
commit37f56fa324fbd175f3804ab817ca728461c0a491 (patch)
tree38e18bc272b6ce66e6c151a861a352e079e2b283
parent208a9b854789cb9934c2d67123b027be150711b5 (diff)
downloadopenttd-37f56fa324fbd175f3804ab817ca728461c0a491.tar.xz
(svn r1538) -Feature: [988816] Disable servicing when breakdowns set to none (jaguar7)
-rw-r--r--lang/english.txt3
-rw-r--r--settings.c1
-rw-r--r--settings_gui.c1
-rw-r--r--variables.h1
-rw-r--r--vehicle.c3
5 files changed, 8 insertions, 1 deletions
diff --git a/lang/english.txt b/lang/english.txt
index 75134a977..a036eca51 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 8d5b86294..10e68952f 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 4bae1e582..cb7eb0ead 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 a743e3dde..2043269f5 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 569610230..dd4d0934c 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);