]> git.tdb.fi Git - r2c2.git/blobdiff - source/libmarklin/route.cpp
Major architecture rework
[r2c2.git] / source / libmarklin / route.cpp
index 20017d240a429562a1e7e3907999eb40c2a2ebb6..7db3f324b61e9ce5d753786aac251982cff6ec90 100644 (file)
@@ -1,7 +1,7 @@
 /* $Id$
 
 This file is part of the MSP Märklin suite
-Copyright © 2007-2009  Mikkosoft Productions, Mikko Rasa
+Copyright © 2007-2010  Mikkosoft Productions, Mikko Rasa
 Distributed under the GPL
 */
 
@@ -15,12 +15,19 @@ using namespace Msp;
 
 namespace Marklin {
 
-Route::Route(Layout &layout, const string &n):
+Route::Route(Layout &l, const string &n):
+       layout(l),
        name(n)
 {
+       layout.add_route(*this);
        layout.signal_track_removed.connect(sigc::mem_fun(this, &Route::track_removed));
 }
 
+Route::~Route()
+{
+       layout.remove_route(*this);
+}
+
 int Route::get_turnout(unsigned id) const
 {
        map<unsigned, int>::const_iterator i = turnouts.find(id);