diff --git a/src/lang/extra/english.txt b/src/lang/extra/english.txt index 7a9ba1ffd3..a7868a3e72 100644 --- a/src/lang/extra/english.txt +++ b/src/lang/extra/english.txt @@ -201,6 +201,9 @@ STR_CONFIG_SETTING_THROUGH_LOAD_SPEED_LIMIT_HELPTEXT :The maximum per STR_CONFIG_SETTING_RAIL_DEPOT_SPEED_LIMIT :Rail depot maximum speed: {STRING2} STR_CONFIG_SETTING_RAIL_DEPOT_SPEED_LIMIT_HELPTEXT :The maximum permitted speed for trains when entering or exiting a rail depot +STR_CONFIG_SETTING_NON_LEADING_ENGINES_KEEP_NAME :Non-leading train engines keep custom names: {STRING2} +STR_CONFIG_SETTING_NON_LEADING_ENGINES_KEEP_NAME_HELPTEXT :Whether train engines with a custom name should keep their custom name when moved to a non-leading position in a train consist + STR_CONFIG_SETTING_BACK_ONE_WAY_PBS_SAFE_WAITING :Pathfind up to back of one-way path signals: {STRING2} STR_CONFIG_SETTING_BACK_ONE_WAY_PBS_SAFE_WAITING_HELPTEXT :When enabled, the YAPF train pathfinder may pathfind up to the back of a one-way path signal. diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 3d31e99af1..d1e5e4c9c6 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -2267,6 +2267,7 @@ static SettingsContainer &GetSettingsTree() vehicles->Add(new SettingEntry("order.nonstop_only")); vehicles->Add(new SettingEntry("vehicle.adjacent_crossings")); vehicles->Add(new SettingEntry("vehicle.safer_crossings")); + vehicles->Add(new SettingEntry("vehicle.non_leading_engines_keep_name")); } SettingsPage *limitations = main->Add(new SettingsPage(STR_CONFIG_SETTING_LIMITATIONS)); diff --git a/src/settings_type.h b/src/settings_type.h index 1fe393c37a..d5f40c9bb3 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -677,6 +677,7 @@ struct VehicleSettings { bool drive_through_train_depot; ///< enable drive-through train depot emulation uint16 through_load_speed_limit; ///< maximum speed for through load uint16 rail_depot_speed_limit; ///< maximum speed entering/existing rail depots + bool non_leading_engines_keep_name; ///< allow engines moved to a non-leading position to retain their custom name }; /** Settings related to the economy. */ diff --git a/src/table/settings/settings.ini b/src/table/settings/settings.ini index fcd03ef1db..7c78292f60 100644 --- a/src/table/settings/settings.ini +++ b/src/table/settings/settings.ini @@ -1503,6 +1503,14 @@ strval = STR_JUST_VELOCITY cat = SC_EXPERT patxname = ""vehicle.rail_depot_speed_limit"" +[SDT_BOOL] +var = vehicle.non_leading_engines_keep_name +def = false +str = STR_CONFIG_SETTING_NON_LEADING_ENGINES_KEEP_NAME +strhelp = STR_CONFIG_SETTING_NON_LEADING_ENGINES_KEEP_NAME_HELPTEXT +cat = SC_ADVANCED +patxname = ""vehicle.non_leading_engines_keep_name"" + [SDT_BOOL] var = pf.forbid_90_deg def = true diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index fb7e97a422..99900913f0 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -2219,7 +2219,9 @@ CommandCost CmdMoveRailVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, u /* Remove stuff not valid anymore for non-front engines. */ DeleteVehicleOrders(src); src->unitnumber = 0; - src->name.clear(); + if (!_settings_game.vehicle.non_leading_engines_keep_name) { + src->name.clear(); + } if (HasBit(src->vehicle_flags, VF_HAVE_SLOT)) { TraceRestrictRemoveVehicleFromAllSlots(src->index); ClrBit(src->vehicle_flags, VF_HAVE_SLOT);