From: Mikko Rasa Date: Sat, 25 May 2013 22:54:24 +0000 (+0300) Subject: Refactor TrackIter::block_iter X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=ada37f44b9c44d726ecc3467ecdfdeb1c4137e44;p=r2c2.git Refactor TrackIter::block_iter The new implementation is slightly more efficient in certain cases and won't choke at the end of a line. --- diff --git a/source/libr2c2/trackiter.cpp b/source/libr2c2/trackiter.cpp index c3bb7d4..31ebf08 100644 --- a/source/libr2c2/trackiter.cpp +++ b/source/libr2c2/trackiter.cpp @@ -30,27 +30,29 @@ BlockIter TrackIter::block_iter() const Block &block = _track->get_block(); const vector &beps = block.get_endpoints(); - if(_track->get_type().is_turnout()) - { - /* A turnouts is the only track in its block. Go ahead and find the - matching endpoint in the block. */ - for(unsigned i=0; iget_type().is_turnout()) { TrackIter rev = reverse(); + TrackIter last; while(rev && &rev.track()->get_block()==&block) { - TrackIter fwd = rev.reverse(); - - for(unsigned i=0; i