Add tracerestrict feature reverse behind signal

This commit is contained in:
Jonathan G Rennison
2018-12-05 20:01:09 +00:00
parent a315d39067
commit cd41683b9b
12 changed files with 162 additions and 6 deletions

View File

@@ -208,17 +208,25 @@ public:
}
/** add multiple nodes - direct children of the given node */
inline void AddMultipleNodes(Node *parent, const TrackFollower &tf)
template <class TNodeFunc>
inline void AddMultipleNodes(Node *parent, const TrackFollower &tf, TNodeFunc node_func)
{
bool is_choice = (KillFirstBit(tf.m_new_td_bits) != TRACKDIR_BIT_NONE);
for (TrackdirBits rtds = tf.m_new_td_bits; rtds != TRACKDIR_BIT_NONE; rtds = KillFirstBit(rtds)) {
Trackdir td = (Trackdir)FindFirstBit2x64(rtds);
Node &n = Yapf().CreateNewNode();
n.Set(parent, tf.m_new_tile, td, is_choice);
node_func(n);
Yapf().AddNewNode(n, tf);
}
}
/** add multiple nodes - direct children of the given node */
inline void AddMultipleNodes(Node *parent, const TrackFollower &tf)
{
AddMultipleNodes(parent, tf, [&](Node &n) {});
}
/**
* In some cases an intermediate node branch should be pruned.
* The most prominent case is when a red EOL signal is encountered, but