X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Fblockiter.cpp;h=9dcca6c68672a9392883ff4ccb4803358588a7f1;hb=d6213fa0f35a06182a7d3e88959c67ff019713b6;hp=038600bbffa933a25c6e5022790b04437b4000dc;hpb=54392d65e2053d1eacb4cfcc435f1013993f2973;p=r2c2.git diff --git a/source/libr2c2/blockiter.cpp b/source/libr2c2/blockiter.cpp index 038600b..9dcca6c 100644 --- a/source/libr2c2/blockiter.cpp +++ b/source/libr2c2/blockiter.cpp @@ -40,24 +40,18 @@ const Block::Endpoint &BlockIter::endpoint() const int BlockIter::get_exit(const Route *route) const { const vector &eps = _block->get_endpoints(); - TrackIter t_iter = track_iter(); - - while(t_iter) + if(_block->get_turnout_address()) { - if(!_block->has_track(*t_iter)) - throw logic_error("internal error (block traversal escaped the block)"); - + /* The endpoints of a turnout block exactly correspond to the endpoints + of the track. */ + TrackIter t_iter = track_iter(); unsigned path = (route ? route->get_path(*t_iter) : t_iter->get_active_path()); - TrackIter t_exit = t_iter.reverse(path); - - for(unsigned i=0; i