]> git.tdb.fi Git - r2c2.git/blobdiff - source/3d/layout.cpp
Rename the project to R²C²
[r2c2.git] / source / 3d / layout.cpp
index 05c398d302a33b3fb22bcc968d82d90f21409abe..5f015766f6367ad53ae108d379cad9ab0c94861c 100644 (file)
@@ -1,6 +1,6 @@
 /* $Id$
 
-This file is part of the MSP Märklin suite
+This file is part of R²C²
 Copyright © 2006-2010 Mikkosoft Productions, Mikko Rasa
 Distributed under the GPL
 */
@@ -20,7 +20,7 @@ Distributed under the GPL
 using namespace std;
 using namespace Msp;
 
-namespace Marklin {
+namespace R2C2 {
 
 Layout3D::Layout3D(Layout &l):
        layout(l),
@@ -29,6 +29,7 @@ Layout3D::Layout3D(Layout &l):
        layout.signal_track_added.connect(sigc::mem_fun(this, &Layout3D::track_added));
        layout.signal_track_removed.connect(sigc::mem_fun(this, &Layout3D::track_removed));
        layout.signal_vehicle_added.connect(sigc::mem_fun(this, &Layout3D::vehicle_added));
+       layout.signal_vehicle_removed.connect(sigc::mem_fun(this, &Layout3D::vehicle_removed));
 
        const set<Track *> &ltracks = layout.get_tracks();
        for(set<Track *>::iterator i=ltracks.begin(); i!=ltracks.end(); ++i)
@@ -140,4 +141,11 @@ void Layout3D::vehicle_added(Vehicle &v)
        new Vehicle3D(*this, v);
 }
 
-} // namespace Marklin
+void Layout3D::vehicle_removed(Vehicle &v)
+{
+       VehicleMap::iterator i = vehicles.find(&v);
+       if(i!=vehicles.end())
+               delete i->second;
+}
+
+} // namespace R2C2