/* $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
*/
using namespace std;
using namespace Msp;
-namespace Marklin {
+namespace R2C2 {
Layout3D::Layout3D(Layout &l):
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 *> <racks = layout.get_tracks();
for(set<Track *>::iterator i=ltracks.begin(); i!=ltracks.end(); ++i)
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