diff options
Diffstat (limited to 'yapf')
-rw-r--r-- | yapf/yapf_base.hpp | 3 | ||||
-rw-r--r-- | yapf/yapf_common.hpp | 7 | ||||
-rw-r--r-- | yapf/yapf_node.hpp | 2 | ||||
-rw-r--r-- | yapf/yapf_node_rail.hpp | 8 | ||||
-rw-r--r-- | yapf/yapf_node_road.hpp | 4 |
5 files changed, 14 insertions, 10 deletions
diff --git a/yapf/yapf_base.hpp b/yapf/yapf_base.hpp index e08422ed3..c5c50fe65 100644 --- a/yapf/yapf_base.hpp +++ b/yapf/yapf_base.hpp @@ -186,10 +186,11 @@ public: /** add multiple nodes - direct children of the given node */ FORCEINLINE void AddMultipleNodes(Node* parent, TileIndex tile, TrackdirBits td_bits) { + bool is_choice = (KillFirstBit2x64(td_bits) != 0); for (TrackdirBits rtds = td_bits; rtds != TRACKDIR_BIT_NONE; rtds = (TrackdirBits)KillFirstBit2x64(rtds)) { Trackdir td = (Trackdir)FindFirstBit2x64(rtds); Node& n = Yapf().CreateNewNode(); - n.Set(parent, tile, td); + n.Set(parent, tile, td, is_choice); Yapf().AddNewNode(n); } } diff --git a/yapf/yapf_common.hpp b/yapf/yapf_common.hpp index 127c73210..e9e827323 100644 --- a/yapf/yapf_common.hpp +++ b/yapf/yapf_common.hpp @@ -30,10 +30,11 @@ public: /// Called when YAPF needs to place origin nodes into open list void PfSetStartupNodes() { + bool is_choice = (KillFirstBit2x64(m_orgTrackdirs) != 0); for (TrackdirBits tdb = m_orgTrackdirs; tdb != TRACKDIR_BIT_NONE; tdb = (TrackdirBits)KillFirstBit2x64(tdb)) { Trackdir td = (Trackdir)FindFirstBit2x64(tdb); Node& n1 = Yapf().CreateNewNode(); - n1.Set(NULL, m_orgTile, td); + n1.Set(NULL, m_orgTile, td, is_choice); Yapf().AddStartupNode(n1); } } @@ -76,12 +77,12 @@ public: { if (m_orgTile != INVALID_TILE && m_orgTd != INVALID_TRACKDIR) { Node& n1 = Yapf().CreateNewNode(); - n1.Set(NULL, m_orgTile, m_orgTd); + n1.Set(NULL, m_orgTile, m_orgTd, false); Yapf().AddStartupNode(n1); } if (m_revTile != INVALID_TILE && m_revTd != INVALID_TRACKDIR) { Node& n2 = Yapf().CreateNewNode(); - n2.Set(NULL, m_revTile, m_revTd); + n2.Set(NULL, m_revTile, m_revTd, false); n2.m_cost = m_reverse_penalty; Yapf().AddStartupNode(n2); } diff --git a/yapf/yapf_node.hpp b/yapf/yapf_node.hpp index 48206ee06..2fa82a6a6 100644 --- a/yapf/yapf_node.hpp +++ b/yapf/yapf_node.hpp @@ -38,7 +38,7 @@ struct CYapfNodeT { int m_cost; int m_estimate; - FORCEINLINE void Set(Node *parent, TileIndex tile, Trackdir td) + FORCEINLINE void Set(Node *parent, TileIndex tile, Trackdir td, bool is_choice) { m_key.Set(tile, td); m_hash_next = NULL; diff --git a/yapf/yapf_node_rail.hpp b/yapf/yapf_node_rail.hpp index 2d566ab4f..df0186989 100644 --- a/yapf/yapf_node_rail.hpp +++ b/yapf/yapf_node_rail.hpp @@ -70,17 +70,18 @@ struct CYapfRailNodeT CYapfRailSegment *m_segment; uint16 m_num_signals_passed; union { - byte m_inherited_flags; + uint32 m_inherited_flags; struct { bool m_targed_seen : 1; + bool m_choice_seen : 1; bool m_last_signal_was_red : 1; } flags_s; } flags_u; SignalType m_last_red_signal_type; - FORCEINLINE void Set(CYapfRailNodeT* parent, TileIndex tile, Trackdir td) + FORCEINLINE void Set(CYapfRailNodeT* parent, TileIndex tile, Trackdir td, bool is_choice) { - base::Set(parent, tile, td); + base::Set(parent, tile, td, is_choice); m_segment = NULL; if (parent == NULL) { m_num_signals_passed = 0; @@ -91,6 +92,7 @@ struct CYapfRailNodeT flags_u.m_inherited_flags = parent->flags_u.m_inherited_flags; m_last_red_signal_type = parent->m_last_red_signal_type; } + flags_u.flags_s.m_choice_seen |= is_choice; } FORCEINLINE TileIndex GetLastTile() const {assert(m_segment != NULL); return m_segment->m_last_tile;} diff --git a/yapf/yapf_node_road.hpp b/yapf/yapf_node_road.hpp index 8a6888565..dc6f1be3a 100644 --- a/yapf/yapf_node_road.hpp +++ b/yapf/yapf_node_road.hpp @@ -15,9 +15,9 @@ struct CYapfRoadNodeT TileIndex m_segment_last_tile; Trackdir m_segment_last_td; - void Set(CYapfRoadNodeT* parent, TileIndex tile, Trackdir td) + void Set(CYapfRoadNodeT* parent, TileIndex tile, Trackdir td, bool is_choice) { - base::Set(parent, tile, td); + base::Set(parent, tile, td, is_choice); m_segment_last_tile = tile; m_segment_last_td = td; } |