diff --git a/lang/english.txt b/lang/english.txt index 348365b897..0a9b730491 100644 --- a/lang/english.txt +++ b/lang/english.txt @@ -1017,6 +1017,7 @@ STR_CONFIG_PATCHES_SERVINT_AIRCRAFT_DISABLED :{LTBLUE}Default STR_CONFIG_PATCHES_SERVINT_SHIPS :{LTBLUE}Default service interval for ships: {ORANGE}{STRING1} 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}{STRING1} +STR_CONFIG_PATCHES_WAGONSPEEDLIMITS :{LTBLUE}Enable wagon speed limits: {ORANGE}{STRING1} STR_CONFIG_PATCHES_COLORED_NEWS_DATE :{LTBLUE}Coloured news appears in: {ORANGE}{STRING1} STR_CONFIG_PATCHES_STARTING_DATE :{LTBLUE}Starting date: {ORANGE}{STRING1} diff --git a/newgrf.c b/newgrf.c index 60ade01924..99d9fdc89a 100644 --- a/newgrf.c +++ b/newgrf.c @@ -2187,7 +2187,8 @@ static void InitializeGRFSpecial(void) _ttdpatch_flags[2] = (1 << 0x0D) /* buildonslopes */ | (1 << 0x16) /* canals */ - | (1 << 0x17); /* newstartyear */ + | (1 << 0x17) /* newstartyear */ + | (_patches.wagon_speed_limits ? (1 << 0x1D) : 0); /* wagonspeedlimits */ } static void InitNewGRFFile(const char* filename, int sprite_offset) diff --git a/settings.c b/settings.c index 8cc0ddd97a..9014900aff 100644 --- a/settings.c +++ b/settings.c @@ -889,6 +889,7 @@ const SettingDesc patch_settings[] = { {"nonuniform_stations", SDT_BOOL, (void*)true, &_patches.nonuniform_stations, NULL}, {"always_small_airport",SDT_BOOL, (void*)false, &_patches.always_small_airport, NULL}, {"realistic_acceleration",SDT_BOOL, (void*)false, &_patches.realistic_acceleration, NULL}, + {"wagon_speed_limits", SDT_BOOL, (void*)true, &_patches.wagon_speed_limits, NULL}, {"forbid_90_deg", SDT_BOOL, (void*)false, &_patches.forbid_90_deg, NULL}, {"improved_load", SDT_BOOL, (void*)false, &_patches.improved_load, NULL}, diff --git a/settings_gui.c b/settings_gui.c index 228c54a753..b0c5f50112 100644 --- a/settings_gui.c +++ b/settings_gui.c @@ -721,6 +721,7 @@ static const PatchEntry _patches_vehicles[] = { {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}, + {PE_BOOL, 0, STR_CONFIG_PATCHES_WAGONSPEEDLIMITS, "wagon_speed_limits", &_patches.wagon_speed_limits, 0, 0, 0, NULL}, }; static const PatchEntry _patches_stations[] = { diff --git a/train_cmd.c b/train_cmd.c index 3fad0435a0..e5b3f2b1be 100644 --- a/train_cmd.c +++ b/train_cmd.c @@ -113,8 +113,9 @@ void TrainConsistChanged(Vehicle *v) { } // max speed is the minimum of the speed limits of all vehicles in the consist - if (rvi_u->max_speed != 0 && !UsesWagonOverride(u)) - max_speed = min(rvi_u->max_speed, max_speed); + if (!(rvi_u->flags & RVI_WAGON) || _patches.wagon_speed_limits) + if (rvi_u->max_speed != 0 && !UsesWagonOverride(u)) + max_speed = min(rvi_u->max_speed, max_speed); // check the vehicle length (callback) veh_len = CALLBACK_FAILED; diff --git a/train_gui.c b/train_gui.c index 514d521830..3c02fa5613 100644 --- a/train_gui.c +++ b/train_gui.c @@ -111,7 +111,7 @@ void DrawTrainWagonPurchaseInfo(int x, int y, EngineID engine_number) y += 10; /* Wagon speed limit, displayed if above zero */ - if (rvi->max_speed > 0) { + if (rvi->max_speed > 0 && _patches.wagon_speed_limits) { SetDParam(0, rvi->max_speed * 10 >> 4); DrawString(x,y, STR_PURCHASE_INFO_SPEED, 0); y += 10; diff --git a/variables.h b/variables.h index ec6cb8bfcb..0eede15e5e 100644 --- a/variables.h +++ b/variables.h @@ -115,6 +115,7 @@ typedef struct Patches { bool nonuniform_stations;// allow nonuniform train stations bool always_small_airport; // always allow small airports bool realistic_acceleration; // realistic acceleration for trains + bool wagon_speed_limits; // enable wagon speed limits bool forbid_90_deg; // forbid trains to make 90 deg turns 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