X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Fblockiter.cpp;h=a3f6d876a8b40000472283ca276c586bcfc1c482;hb=d41f66805bc9fe0b33e3d46b47f52e67b5782028;hp=038600bbffa933a25c6e5022790b04437b4000dc;hpb=54392d65e2053d1eacb4cfcc435f1013993f2973;p=r2c2.git diff --git a/source/libr2c2/blockiter.cpp b/source/libr2c2/blockiter.cpp index 038600b..a3f6d87 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_id()) { - 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