TrackType3D::TrackType3D(Catalogue3D &cat3d, const TrackType &tt):
catalogue(cat3d),
mesh(0),
- object(0)
+ object(0),
+ own_data(false)
{
const Catalogue &cat = cat3d.get_catalogue();
const vector<TrackPart> &parts = tt.get_parts();
object = new GL::Object;
object->set_mesh(mesh);
object->set_technique(&catalogue.get<GL::Technique>(cat.get_track_technique()));
+
+ own_data = true;
}
unsigned paths = tt.get_paths();
{
for(vector<GL::Mesh *>::iterator i=path_meshes.begin(); i!=path_meshes.end(); ++i)
delete *i;
+ if(own_data)
+ {
+ delete object;
+ delete mesh;
+ }
}
const GL::Mesh &TrackType3D::get_path_mesh(unsigned p) const
{
for(TrackMap::iterator i=tracks.begin(); i!=tracks.end(); ++i)
delete i->second;
+ for(SignalMap::iterator i=signals.begin(); i!=signals.end(); ++i)
+ delete i->second;
for(VehicleMap::iterator i=vehicles.begin(); i!=vehicles.end(); ++i)
delete i->second;
}