summaryrefslogtreecommitdiff
path: root/src/yapf/yapf_node_rail.hpp
diff options
context:
space:
mode:
authorKUDr <KUDr@openttd.org>2007-06-26 22:29:52 +0000
committerKUDr <KUDr@openttd.org>2007-06-26 22:29:52 +0000
commit3332b21b19a0ca2d515da96fe4104e0ba5cda8b4 (patch)
tree6fe04cfb8f7d7cc785a1cbcb8f57cdc2f686a049 /src/yapf/yapf_node_rail.hpp
parentab52e3da5295dd8b6eb88f4740f21bfb59c07b5f (diff)
downloadopenttd-3332b21b19a0ca2d515da96fe4104e0ba5cda8b4.tar.xz
(svn r10349) -Fix [FS#941, YAPF, r10301]: tile/trackdir must be used as node key and also as segment key in the cache (SmatZ).
In the past it was possible to use tile/exitdir as the key because segments beginning on the same tile/exitdir were incorrectly considered the same. What I still don't understand is why this bug happened only on 64 bit systems (linux, Win64).
Diffstat (limited to 'src/yapf/yapf_node_rail.hpp')
-rw-r--r--src/yapf/yapf_node_rail.hpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/yapf/yapf_node_rail.hpp b/src/yapf/yapf_node_rail.hpp
index 20737c3aa..4097fc505 100644
--- a/src/yapf/yapf_node_rail.hpp
+++ b/src/yapf/yapf_node_rail.hpp
@@ -11,14 +11,13 @@ struct CYapfRailSegmentKey
uint32 m_value;
FORCEINLINE CYapfRailSegmentKey(const CYapfRailSegmentKey& src) : m_value(src.m_value) {}
- FORCEINLINE CYapfRailSegmentKey(const CYapfNodeKeyExitDir& node_key) {Set(node_key);}
+ FORCEINLINE CYapfRailSegmentKey(const CYapfNodeKeyTrackDir& node_key) {Set(node_key);}
FORCEINLINE void Set(const CYapfRailSegmentKey& src) {m_value = src.m_value;}
- FORCEINLINE void Set(const CYapfNodeKeyExitDir& node_key) {m_value = (((int)node_key.m_tile) << 2) | node_key.m_exitdir;}
+ FORCEINLINE void Set(const CYapfNodeKeyTrackDir& node_key) {m_value = (((int)node_key.m_tile) << 3) | node_key.m_td;}
FORCEINLINE int32 CalcHash() const {return m_value;}
- FORCEINLINE TileIndex GetTile() const {return (TileIndex)(m_value >> 2);}
- FORCEINLINE DiagDirection GetExitDir() const {return (DiagDirection)(m_value & 3);}
+ FORCEINLINE TileIndex GetTile() const {return (TileIndex)(m_value >> 3);}
FORCEINLINE bool operator == (const CYapfRailSegmentKey& other) const {return m_value == other.m_value;}
};
@@ -103,7 +102,6 @@ struct CYapfRailSegment
FORCEINLINE const Key& GetKey() const {return m_key;}
FORCEINLINE TileIndex GetTile() const {return m_key.GetTile();}
- FORCEINLINE DiagDirection GetExitDir() const {return m_key.GetExitDir();}
FORCEINLINE CYapfRailSegment* GetHashNext() {return m_hash_next;}
FORCEINLINE void SetHashNext(CYapfRailSegment* next) {m_hash_next = next;}
};