summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/settings.cpp1
-rw-r--r--src/settings_type.h1
-rw-r--r--src/yapf/yapf_costrail.hpp2
3 files changed, 3 insertions, 1 deletions
diff --git a/src/settings.cpp b/src/settings.cpp
index 703b5c9d4..71f4463eb 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -1726,6 +1726,7 @@ const SettingDesc _patch_settings[] = {
SDT_CONDVAR(GameSettings, pf.yapf.rail_look_ahead_signal_p1, SLE_INT, 28, SL_MAX_VERSION, 0, 0, -100, -1000000, 1000000, 0, STR_NULL, NULL),
SDT_CONDVAR(GameSettings, pf.yapf.rail_look_ahead_signal_p2, SLE_INT, 28, SL_MAX_VERSION, 0, 0, 5, -1000000, 1000000, 0, STR_NULL, NULL),
SDT_CONDVAR(GameSettings, pf.yapf.rail_pbs_cross_penalty, SLE_UINT,100, SL_MAX_VERSION, 0, 0, 3 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL),
+ SDT_CONDVAR(GameSettings, pf.yapf.rail_pbs_station_penalty, SLE_UINT,100, SL_MAX_VERSION, 0, 0, 8 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL),
SDT_CONDVAR(GameSettings, pf.yapf.rail_pbs_signal_back_penalty, SLE_UINT,100, SL_MAX_VERSION, 0, 0, 15 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL),
SDT_CONDVAR(GameSettings, pf.yapf.rail_doubleslip_penalty, SLE_UINT,100, SL_MAX_VERSION, 0, 0, 1 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL),
SDT_CONDVAR(GameSettings, pf.yapf.rail_longer_platform_penalty, SLE_UINT, 33, SL_MAX_VERSION, 0, 0, 8 * YAPF_TILE_LENGTH, 0, 20000, 0, STR_NULL, NULL),
diff --git a/src/settings_type.h b/src/settings_type.h
index d2d3a183f..708d44134 100644
--- a/src/settings_type.h
+++ b/src/settings_type.h
@@ -219,6 +219,7 @@ struct YAPFSettings {
int32 rail_look_ahead_signal_p1; ///< constant in polynomial penalty function
int32 rail_look_ahead_signal_p2; ///< constant in polynomial penalty function
uint32 rail_pbs_cross_penalty; ///< penalty for crossing a reserved tile
+ uint32 rail_pbs_station_penalty; ///< penalty for crossing a reserved station tile
uint32 rail_pbs_signal_back_penalty; ///< penalty for passing a pbs signal from the backside
uint32 rail_doubleslip_penalty; ///< penalty for passing a double slip switch
diff --git a/src/yapf/yapf_costrail.hpp b/src/yapf/yapf_costrail.hpp
index f959f1a3e..60eaae390 100644
--- a/src/yapf/yapf_costrail.hpp
+++ b/src/yapf/yapf_costrail.hpp
@@ -145,7 +145,7 @@ public:
if (n.m_num_signals_passed >= m_sig_look_ahead_costs.Size() / 2) return 0;
if (TrackOverlapsTracks(GetReservedTrackbits(tile), TrackdirToTrack(trackdir))) {
- int cost = Yapf().PfGetSettings().rail_pbs_cross_penalty;
+ int cost = IsRailwayStationTile(tile) ? Yapf().PfGetSettings().rail_pbs_station_penalty : Yapf().PfGetSettings().rail_pbs_cross_penalty;
if (!IsDiagonalTrackdir(trackdir)) cost = (cost * YAPF_TILE_CORNER_LENGTH) / YAPF_TILE_LENGTH;
return cost * (skipped + 1);
}