diff options
author | KUDr <KUDr@openttd.org> | 2007-06-27 22:29:57 +0000 |
---|---|---|
committer | KUDr <KUDr@openttd.org> | 2007-06-27 22:29:57 +0000 |
commit | 7eb0b004f35cee37219845ae50fb8eb712c23899 (patch) | |
tree | 9e674070b355047cdc2eff71b8e79f77d03444a9 /src/yapf/yapf_costrail.hpp | |
parent | daafda6f620dcfaad12468a301ea0620e45eb7c5 (diff) | |
download | openttd-7eb0b004f35cee37219845ae50fb8eb712c23899.tar.xz |
(svn r10366) -Codechange [YAPF]: added DEBUG_YAPF_CACHE macro that (when set to 1) allows to track YAPF "cache errors". They are probably responsible for current MP desyncs. (thanks Rubidium for this great idea!).
I will deal with those errors/desyncs tomorrow.
Diffstat (limited to 'src/yapf/yapf_costrail.hpp')
-rw-r--r-- | src/yapf/yapf_costrail.hpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/yapf/yapf_costrail.hpp b/src/yapf/yapf_costrail.hpp index c27a28167..4fd541ce6 100644 --- a/src/yapf/yapf_costrail.hpp +++ b/src/yapf/yapf_costrail.hpp @@ -55,6 +55,7 @@ protected: protected: int m_max_cost; CBlobT<int> m_sig_look_ahead_costs; + bool m_disable_cache; public: bool m_stopped_on_first_two_way_signal; @@ -64,6 +65,7 @@ protected: CYapfCostRailT() : m_max_cost(0) + , m_disable_cache(false) , m_stopped_on_first_two_way_signal(false) { // pre-compute look-ahead penalties into array @@ -468,7 +470,8 @@ no_entry_cost: // jump here at the beginning if the node has no parent (it is th FORCEINLINE bool CanUseGlobalCache(Node& n) const { - return (n.m_parent != NULL) + return !m_disable_cache + && (n.m_parent != NULL) && (n.m_parent->m_num_signals_passed >= m_sig_look_ahead_costs.Size()); } @@ -481,6 +484,10 @@ no_entry_cost: // jump here at the beginning if the node has no parent (it is th } } + void DisableCache(bool disable) + { + m_disable_cache = disable; + } }; |