X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibmarklin%2Flayout.cpp;h=67d646b1d5f542b1e5b156713c7ef79156660ba0;hb=f42183985c65e1e12f19e9246dee90b8e7e44a34;hp=3a6b6302d56ebf806c442ce8f8c808fb903a5091;hpb=6dc18b0e518407bd2a86602bae1e9bbae05da7c8;p=r2c2.git diff --git a/source/libmarklin/layout.cpp b/source/libmarklin/layout.cpp index 3a6b630..67d646b 100644 --- a/source/libmarklin/layout.cpp +++ b/source/libmarklin/layout.cpp @@ -45,6 +45,14 @@ void Layout::add_route(Route &r) signal_route_added.emit(r); } +Route &Layout::get_route(const string &name) const +{ + for(set::const_iterator i=routes.begin(); i!=routes.end(); ++i) + if((*i)->get_name()==name) + return **i; + throw KeyError("Unknown route", name); +} + void Layout::remove_route(Route &r) { if(routes.erase(&r)) @@ -120,6 +128,9 @@ void Layout::check_routes() } } + if(!track) + continue; + (*i)->add_track(*track); const vector &eps = track->get_type().get_endpoints();