diff options
author | rubidium <rubidium@openttd.org> | 2008-08-02 22:51:38 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2008-08-02 22:51:38 +0000 |
commit | 22b787791fc06423fd1d6b76ee78372febe027cb (patch) | |
tree | 516461a2cb4895dd0fe7f43510712cb25bbcad65 | |
parent | 968a0e907c6567d447aa2905c6c21cf04b432e0f (diff) | |
download | openttd-22b787791fc06423fd1d6b76ee78372febe027cb.tar.xz |
(svn r13943) -Codechange [YAPP]: Reserved station tiles can now be penalized more in YAPF. This should help with spread out stations. (michi_cc)
-rw-r--r-- | src/settings.cpp | 1 | ||||
-rw-r--r-- | src/settings_type.h | 1 | ||||
-rw-r--r-- | src/yapf/yapf_costrail.hpp | 2 |
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); } |