diff options
author | peter1138 <peter1138@openttd.org> | 2009-03-04 08:02:16 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2009-03-04 08:02:16 +0000 |
commit | f0de54bc10d158bbb1ae58b628c0896a56880540 (patch) | |
tree | c01ea5ac1459d5c07f3332f8887c8df85fe37e54 /src/yapf/yapf_node_rail.hpp | |
parent | 0682c1c46cce7b74231486a0b8507e6e7a9b4128 (diff) | |
download | openttd-f0de54bc10d158bbb1ae58b628c0896a56880540.tar.xz |
(svn r15609) -Fix: Code style...
Diffstat (limited to 'src/yapf/yapf_node_rail.hpp')
-rw-r--r-- | src/yapf/yapf_node_rail.hpp | 86 |
1 files changed, 70 insertions, 16 deletions
diff --git a/src/yapf/yapf_node_rail.hpp b/src/yapf/yapf_node_rail.hpp index 4bb8f9868..4ccef7562 100644 --- a/src/yapf/yapf_node_rail.hpp +++ b/src/yapf/yapf_node_rail.hpp @@ -11,15 +11,41 @@ struct CYapfRailSegmentKey uint32 m_value; FORCEINLINE CYapfRailSegmentKey(const CYapfRailSegmentKey& src) : m_value(src.m_value) {} - 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) << 4) | node_key.m_td;} + 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) << 4) | node_key.m_td; + } + + FORCEINLINE int32 CalcHash() const + { + return m_value; + } + + FORCEINLINE TileIndex GetTile() const + { + return (TileIndex)(m_value >> 4); + } + + FORCEINLINE Trackdir GetTrackdir() const + { + return (Trackdir)(m_value & 0x0F); + } - FORCEINLINE int32 CalcHash() const {return m_value;} - 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;} + FORCEINLINE bool operator == (const CYapfRailSegmentKey& other) const + { + return m_value == other.m_value; + } void Dump(DumpTarget &dmp) const { @@ -122,10 +148,25 @@ struct CYapfRailSegment , m_hash_next(NULL) {} - FORCEINLINE const Key& GetKey() const {return m_key;} - FORCEINLINE TileIndex GetTile() const {return m_key.GetTile();} - FORCEINLINE CYapfRailSegment *GetHashNext() {return m_hash_next;} - FORCEINLINE void SetHashNext(CYapfRailSegment *next) {m_hash_next = next;} + FORCEINLINE const Key& GetKey() const + { + return m_key; + } + + FORCEINLINE TileIndex GetTile() const + { + return m_key.GetTile(); + } + + FORCEINLINE CYapfRailSegment *GetHashNext() + { + return m_hash_next; + } + + FORCEINLINE void SetHashNext(CYapfRailSegment *next) + { + m_hash_next = next; + } void Dump(DumpTarget &dmp) const { @@ -175,9 +216,24 @@ struct CYapfRailNodeT flags_u.flags_s.m_choice_seen |= is_choice; } - FORCEINLINE TileIndex GetLastTile() const {assert(m_segment != NULL); return m_segment->m_last_tile;} - FORCEINLINE Trackdir GetLastTrackdir() const {assert(m_segment != NULL); return m_segment->m_last_td;} - FORCEINLINE void SetLastTileTrackdir(TileIndex tile, Trackdir td) {assert(m_segment != NULL); m_segment->m_last_tile = tile; m_segment->m_last_td = td;} + FORCEINLINE TileIndex GetLastTile() const + { + assert(m_segment != NULL); + return m_segment->m_last_tile; + } + + FORCEINLINE Trackdir GetLastTrackdir() const + { + assert(m_segment != NULL); + return m_segment->m_last_td; + } + + FORCEINLINE void SetLastTileTrackdir(TileIndex tile, Trackdir td) + { + assert(m_segment != NULL); + m_segment->m_last_tile = tile; + m_segment->m_last_td = td; + } template <class Tbase, class Tfunc, class Tpf> bool IterateTiles(const Vehicle *v, Tpf &yapf, Tbase &obj, bool (Tfunc::*func)(TileIndex, Trackdir)) const @@ -218,6 +274,4 @@ typedef CYapfRailNodeT<CYapfNodeKeyTrackDir> CYapfRailNodeTrackDir; typedef CNodeList_HashTableT<CYapfRailNodeExitDir , 10, 12> CRailNodeListExitDir; typedef CNodeList_HashTableT<CYapfRailNodeTrackDir, 12, 16> CRailNodeListTrackDir; - - #endif /* YAPF_NODE_RAIL_HPP */ |