diff --git a/src/lang/extra/english.txt b/src/lang/extra/english.txt index 2457d84076..6912cb769d 100644 --- a/src/lang/extra/english.txt +++ b/src/lang/extra/english.txt @@ -2026,3 +2026,5 @@ STR_ERROR_TUNNEL_DISALLOWED_ROAD :{WHITE}Tunnels STR_REFIT_SHIP_PART_DROPDOWN_TOOLTIP :{BLACK}Select which part of this ship to refit STR_REFIT_WHOLE_SHIP :Whole ship STR_REFIT_SHIP_PART :Part {NUM} + +STR_VERY_REDUCED :Very reduced diff --git a/src/table/settings/settings.ini b/src/table/settings/settings.ini index aa5e410f14..5b736cd086 100644 --- a/src/table/settings/settings.ini +++ b/src/table/settings/settings.ini @@ -164,6 +164,14 @@ static const SettingDescEnumEntry _viewport_map_modes[] = { { 0, STR_NULL } }; +static const SettingDescEnumEntry _vehicle_breakdown_modes[] = { +{ 0, STR_DISASTER_NONE }, +{ 64, STR_VERY_REDUCED }, +{ 1, STR_DISASTER_REDUCED }, +{ 2, STR_DISASTER_NORMAL }, +{ 0, STR_NULL } +}; + /* Some settings do not need to be synchronised when playing in multiplayer. * These include for example the GUI settings and will not be saved with the * savegame. @@ -365,18 +373,14 @@ def = 0 min = 0 max = 2 -[SDT_VAR] +[SDT_ENUM] var = difficulty.vehicle_breakdowns type = SLE_UINT8 from = SLV_97 -flags = SF_GUI_DROPDOWN def = 1 -min = 0 -max = 2 -interval = 1 +enumlist = _vehicle_breakdown_modes str = STR_CONFIG_SETTING_VEHICLE_BREAKDOWNS strhelp = STR_CONFIG_SETTING_VEHICLE_BREAKDOWNS_HELPTEXT -strval = STR_DISASTER_NONE cat = SC_BASIC [SDT_VAR] diff --git a/src/vehicle.cpp b/src/vehicle.cpp index ccd719fd12..8b4c27be58 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -2175,6 +2175,9 @@ void CheckVehicleBreakdown(Vehicle *v) } /** * Chance is (1 - reliability) * breakdown_setting * breakdown_chance / 10. + * breakdown_setting is scaled by 2 to support a value of 1/2 (setting value 64). + * Chance is (1 - reliability) * breakdown_scaling_x2 * breakdown_chance / 20. + * * At 90% reliabilty, normal setting (2) and average breakdown_chance (128), * a vehicle will break down (on average) every 100 days. * This *should* mean that vehicles break down about as often as (or a little less than) they used to. @@ -2182,7 +2185,8 @@ void CheckVehicleBreakdown(Vehicle *v) * their impact will be significantly less. */ uint32 r1 = Random(); - if ((uint32) (0xffff - v->reliability) * _settings_game.difficulty.vehicle_breakdowns * chance > GB(r1, 0, 24) * 10) { + uint32 breakdown_scaling_x2 = (_settings_game.difficulty.vehicle_breakdowns == 64) ? 1 : (_settings_game.difficulty.vehicle_breakdowns * 2); + if ((uint32) (0xffff - v->reliability) * breakdown_scaling_x2 * chance > GB(r1, 0, 24) * 10 * 2) { uint32 r2 = Random(); v->breakdown_ctr = GB(r1, 24, 6) + 0xF; if (v->type == VEH_TRAIN) SetBit(Train::From(v)->First()->flags, VRF_CONSIST_BREAKDOWN);