X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2F3d%2Flayout.cpp;h=05aaa4205bf85053d7a0c1513253fddf5cef87b7;hb=9b05c573a38639827697fe393d55b7c76f5bde45;hp=05c398d302a33b3fb22bcc968d82d90f21409abe;hpb=6e5d36dbc3f1e4a221d424fa7d57b07998df67a8;p=r2c2.git diff --git a/source/3d/layout.cpp b/source/3d/layout.cpp index 05c398d..05aaa42 100644 --- a/source/3d/layout.cpp +++ b/source/3d/layout.cpp @@ -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 <racks = layout.get_tracks(); for(set::iterator i=ltracks.begin(); i!=ltracks.end(); ++i) @@ -140,4 +141,11 @@ void Layout3D::vehicle_added(Vehicle &v) new Vehicle3D(*this, v); } +void Layout3D::vehicle_removed(Vehicle &v) +{ + VehicleMap::iterator i = vehicles.find(&v); + if(i!=vehicles.end()) + delete i->second; +} + } // namespace Marklin