Add PF setting for whether to pathfind up to back of one-way PBS

This commit is contained in:
Jonathan G Rennison 2021-06-09 20:43:57 +01:00
parent d8d01276c5
commit a7d8c6fe0c
5 changed files with 19 additions and 7 deletions

View File

@ -1275,6 +1275,8 @@ STR_CONFIG_SETTING_ROAD_VEHICLE_SLOPE_STEEPNESS :Slope steepness
STR_CONFIG_SETTING_ROAD_VEHICLE_SLOPE_STEEPNESS_HELPTEXT :Steepness of a sloped tile for a road vehicle. Higher values make it more difficult to climb a hill
STR_CONFIG_SETTING_FORBID_90_DEG :Forbid trains from making 90° turns: {STRING2}
STR_CONFIG_SETTING_FORBID_90_DEG_HELPTEXT :90 degree turns occur when a horizontal track is directly followed by a vertical track piece on the adjacent tile, thus making the train turn by 90 degree when traversing the tile edge instead of the usual 45 degrees for other track combinations.
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.
STR_CONFIG_SETTING_DISTANT_JOIN_STATIONS :Allow to join stations not directly adjacent: {STRING2}
STR_CONFIG_SETTING_DISTANT_JOIN_STATIONS_HELPTEXT :Allow adding parts to a station without directly touching the existing parts. Needs Ctrl+Click while placing the new parts
STR_CONFIG_SETTING_INFLATION :Inflation: {STRING2}

View File

@ -697,7 +697,8 @@ no_entry_cost: // jump here at the beginning if the node has no parent (it is th
if (HasSignalOnTrackdir(next.tile, next.td) && IsPbsSignal(GetSignalType(next.tile, TrackdirToTrack(next.td)))) {
/* Possible safe tile. */
end_segment_reason |= ESRB_SAFE_TILE;
} else if (HasSignalOnTrackdir(next.tile, ReverseTrackdir(next.td)) && GetSignalType(next.tile, TrackdirToTrack(next.td)) == SIGTYPE_PBS_ONEWAY) {
} else if (likely(_settings_game.pf.back_of_one_way_pbs_waiting_point) && HasSignalOnTrackdir(next.tile, ReverseTrackdir(next.td)) &&
GetSignalType(next.tile, TrackdirToTrack(next.td)) == SIGTYPE_PBS_ONEWAY) {
/* Possible safe tile, but not so good as it's the back of a signal... */
end_segment_reason |= ESRB_SAFE_TILE | ESRB_DEAD_END;
extra_cost += Yapf().PfGetSettings().rail_lastred_exit_penalty;

View File

@ -1936,6 +1936,7 @@ static SettingsContainer &GetSettingsTree()
routing->Add(new SettingEntry("pf.pathfinder_for_trains"));
routing->Add(new SettingEntry("difficulty.line_reverse_mode"));
routing->Add(new SettingEntry("pf.reverse_at_signals"));
routing->Add(new SettingEntry("pf.back_of_one_way_pbs_waiting_point"));
routing->Add(new SettingEntry("pf.forbid_90_deg"));
routing->Add(new SettingEntry("pf.pathfinder_for_roadvehs"));
routing->Add(new SettingEntry("pf.pathfinder_for_ships"));

View File

@ -529,6 +529,7 @@ struct PathfinderSettings {
bool roadveh_queue; ///< buggy road vehicle queueing
bool forbid_90_deg; ///< forbid trains to make 90 deg turns
bool back_of_one_way_pbs_waiting_point;///< whether the back of one-way PBS signals is a safe waiting point
uint8 reroute_rv_on_layout_change; ///< whether to re-route road vehicles when the layout changes
bool reverse_at_signals; ///< whether to reverse at signals at all

View File

@ -1327,15 +1327,22 @@ strhelp = STR_CONFIG_SETTING_FORBID_90_DEG_HELPTEXT
proc = InvalidateShipPathCache
cat = SC_EXPERT
;; pf.back_of_one_way_pbs_waiting_point
[SDT_NULL]
length = 1
[SDT_XREF]
extver = SlXvFeatureTest(XSLFTO_AND, XSLFI_JOKERPP)
xref = ""pf.back_of_one_way_pbs_waiting_point""
;; pf.back_of_one_way_pbs_waiting_point
[SDT_NULL]
length = 1
[SDT_XREF]
extver = SlXvFeatureTest(XSLFTO_AND, XSLFI_CHILLPP, SL_CHILLPP_232)
xref = ""pf.back_of_one_way_pbs_waiting_point""
[SDT_BOOL]
base = GameSettings
var = pf.back_of_one_way_pbs_waiting_point
def = true
str = STR_CONFIG_SETTING_BACK_ONE_WAY_PBS_SAFE_WAITING
str = STR_CONFIG_SETTING_BACK_ONE_WAY_PBS_SAFE_WAITING_HELPTEXT
cat = SC_EXPERT
patxname = ""pf.back_of_one_way_pbs_waiting_point""
[SDT_VAR]
base = GameSettings