]> git.tdb.fi Git - r2c2.git/blobdiff - source/libmarklin/layout.cpp
Add Block::has_track and Route::has_track methods
[r2c2.git] / source / libmarklin / layout.cpp
index f89b78335d30f0f720778ccbcd4b3822fc8defb8..f8ad397f183992507ea2eb0140d1d2ae20bccf2c 100644 (file)
@@ -98,7 +98,7 @@ Block &Layout::get_block(unsigned id) const
 Block &Layout::get_block_by_track(Track &t) const
 {
        for(set<Block *>::const_iterator i=blocks.begin(); i!=blocks.end(); ++i)
-               if((*i)->get_tracks().count(&t))
+               if((*i)->has_track(t))
                        return **i;
 
        throw InvalidParameterValue("No block found for track");
@@ -131,9 +131,9 @@ void Layout::create_blocks(Track &track)
        const vector<Track *> &links = track.get_links();
        for(set<Block *>::iterator i=blocks.begin(); i!=blocks.end();)
        {
-               bool del = (*i)->get_tracks().count(&track);
+               bool del = (*i)->has_track(track);
                for(vector<Track *>::const_iterator j=links.begin(); (!del && j!=links.end()); ++j)
-                       del = (*i)->get_tracks().count(*j);
+                       del = (*i)->has_track(**j);
 
                if(del)
                        delete *i++;