summaryrefslogtreecommitdiff
path: root/src/yapf
diff options
context:
space:
mode:
authorKUDr <KUDr@openttd.org>2007-06-29 23:50:42 +0000
committerKUDr <KUDr@openttd.org>2007-06-29 23:50:42 +0000
commit41b75d545e3fbcfa761cc70b6ce02e3b8ffbc253 (patch)
tree81ce0c57a768a15b2ef8aea9a30f8fe855dc8cb3 /src/yapf
parent90fe88a7af790433befa6714de8fce350bd9f184 (diff)
downloadopenttd-41b75d545e3fbcfa761cc70b6ce02e3b8ffbc253.tar.xz
(svn r10393) -Fix [YAPF]: Trackdir needs 4 bits to store (not 3). The cached segment key didn't use the highest trackdir bit. It could confuse YAPF on bi-directional track segments.
Diffstat (limited to 'src/yapf')
-rw-r--r--src/yapf/yapf_node_rail.hpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/yapf/yapf_node_rail.hpp b/src/yapf/yapf_node_rail.hpp
index 59aa696f7..3d112888d 100644
--- a/src/yapf/yapf_node_rail.hpp
+++ b/src/yapf/yapf_node_rail.hpp
@@ -14,10 +14,11 @@ struct CYapfRailSegmentKey
FORCEINLINE CYapfRailSegmentKey(const CYapfNodeKeyTrackDir& node_key) {Set(node_key);}
FORCEINLINE void Set(const CYapfRailSegmentKey& src) {m_value = src.m_value;}
- FORCEINLINE void Set(const CYapfNodeKeyTrackDir& node_key) {m_value = (((int)node_key.m_tile) << 3) | node_key.m_td;}
+ FORCEINLINE void Set(const CYapfNodeKeyTrackDir& node_key) {m_value = (((int)node_key.m_tile) << 4) | node_key.m_td;}
FORCEINLINE int32 CalcHash() const {return m_value;}
- FORCEINLINE TileIndex GetTile() const {return (TileIndex)(m_value >> 3);}
+ FORCEINLINE TileIndex GetTile() const {return (TileIndex)(m_value >> 4);}
+ FORCEINLINE Trackdir GetTrackdir() const {return (Trackdir)(m_value & 0x0F);}
FORCEINLINE bool operator == (const CYapfRailSegmentKey& other) const {return m_value == other.m_value;}
void Dump(DumpTarget &dmp) const