- const TrackType::Endpoint &next_entry_ep = next_track.endpoint();
- for(unsigned i=0; next_entry_ep.paths>>i; ++i)
- if(next_entry_ep.has_path(i))
- {
- train.path = i;
- train.update_estimate();
- next.update_estimate();
- if(next.is_viable())
- new_steps.push_back(next);
- }
+ const TrackType::Endpoint &entry_ep = train.track.endpoint();
+ if(train.critical)
+ {
+ /* Only create a successor step matching the currently set path for a
+ critical track. */
+ unsigned critical_path = train.track->get_type().coerce_path(train.track.entry(), train.track->get_active_path());
+ create_successor(next, train_index, critical_path, new_steps);
+ }
+ else
+ {
+ // Create successor steps for all possible paths through the new track.
+ for(unsigned i=0; entry_ep.paths>>i; ++i)
+ if(entry_ep.has_path(i))
+ create_successor(next, train_index, i, new_steps);
+ }