]> git.tdb.fi Git - r2c2.git/blobdiff - source/libr2c2/train.cpp
Mark turnout blocks before the next sensor as current
[r2c2.git] / source / libr2c2 / train.cpp
index 099e7611c3fbe7c63c1da2a6d432acc8614228a0..936f74aa82d6d522bb74a7d500a59eeecea0f2d2 100644 (file)
@@ -542,7 +542,7 @@ void Train::free_noncritical_blocks()
        }
 }
 
-int Train::get_entry_to_block(Block &block) const
+int Train::get_entry_to_block(const Block &block) const
 {
        for(BlockList::const_iterator i=blocks.begin(); i!=blocks.end(); ++i)
                if(i->block()==&block)
@@ -1105,6 +1105,8 @@ void Train::check_turnout_paths(bool set)
 
                if(i==clear_blocks_end)
                        ++clear_blocks_end;
+               if(i==cur_blocks_end && !(*i)->get_sensor_id())
+                       ++cur_blocks_end;
        }
 }
 
@@ -1289,7 +1291,7 @@ Train::RouteRef::RouteRef(const Route *r, unsigned d):
 
 
 Train::Loader::Loader(Train &t):
-       DataFile::BasicLoader<Train>(t),
+       DataFile::ObjectLoader<Train>(t),
        prev_block(0),
        blocks_valid(true)
 {