X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Ftrackiter.cpp;h=330e2f66c810bd9ee2c38cd0c6f2f1ebd14ae6d7;hb=a44355019e5a27da0d5e5287aae74864e4122e1f;hp=31ebf08e1f1c59711208c0f51722480cbc529c46;hpb=ada37f44b9c44d726ecc3467ecdfdeb1c4137e44;p=r2c2.git diff --git a/source/libr2c2/trackiter.cpp b/source/libr2c2/trackiter.cpp index 31ebf08..330e2f6 100644 --- a/source/libr2c2/trackiter.cpp +++ b/source/libr2c2/trackiter.cpp @@ -37,18 +37,20 @@ BlockIter TrackIter::block_iter() const if(!_track->get_type().is_turnout()) { - TrackIter rev = reverse(); + /* Since there was no endpoint match, the preceding track can't be in a + different block. */ + TrackIter rev = flip(); TrackIter last; while(rev && &rev.track()->get_block()==&block) { last = rev; rev = rev.next(); - - // If we ran out of tracks, return an empty iterator - if(!rev) - return BlockIter(); } + // If we ran out of tracks, return an empty iterator + if(!rev) + return BlockIter(); + TrackIter fwd = last.reverse(); for(unsigned i=0; iget_type().coerce_path(_entry, path); const vector &eps = _track->get_type().get_endpoints(); // Find an endpoint that's connected to the entry and has the requested path