Skip to content
Snippets Groups Projects
Commit 974d4f74 authored by Sergi Hernandez's avatar Sergi Hernandez
Browse files

Solved a bug in the free function: the vectors were not cleared.

When loading a map (opendrive or OSM) free any previous data.
parent 8fa8a452
No related branches found
No related tags found
1 merge request!2Solved a bug when creating a new geometry object: the sale factor is...
......@@ -27,12 +27,17 @@ void CRoadMap::free(void)
delete this->roads[i];
this->roads[i]=NULL;
}
this->roads.clear();
for(unsigned int i=0;i<this->junctions.size();i++)
if(this->junctions[i]!=NULL)
{
delete this->junctions[i];
this->junctions[i]=NULL;
}
this->junctions.clear();
this->next_segment_id=0;
this->next_road_id=0;
this->next_junction_id=0;
}
unsigned int CRoadMap::get_next_segment_id(void)
......@@ -217,6 +222,7 @@ void CRoadMap::load_opendrive(const std::string &filename)
opendrive_map_pair_t map_pair;
std::vector<CRoad *> segment_roads;
this->free();
if(stat(filename.c_str(),&buffer)==0)
{
try{
......@@ -378,6 +384,7 @@ void CRoadMap::load_osm(const std::string &filename)
{
COSMMap road_map;
this->free();
road_map.load(filename);
road_map.convert(*this);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment