diff --git a/siteupdate/cplusplus/classes/GraphGeneration/HGVertex.cpp b/siteupdate/cplusplus/classes/GraphGeneration/HGVertex.cpp index 19d40279..9107f6f7 100644 --- a/siteupdate/cplusplus/classes/GraphGeneration/HGVertex.cpp +++ b/siteupdate/cplusplus/classes/GraphGeneration/HGVertex.cpp @@ -55,6 +55,8 @@ HGVertex::~HGVertex() { //std::cout << "deleting vertex at " << first_waypoint->str() << std::endl; while (incident_s_edges.size()) delete incident_s_edges.front(); while (incident_c_edges.size()) delete incident_c_edges.front(); + while (incident_t_edges.size()) delete incident_t_edges.front(); delete[] s_vertex_num; delete[] c_vertex_num; + delete[] t_vertex_num; } diff --git a/siteupdate/cplusplus/classes/GraphGeneration/HighwayGraph.cpp b/siteupdate/cplusplus/classes/GraphGeneration/HighwayGraph.cpp index 3dec1803..581070c8 100644 --- a/siteupdate/cplusplus/classes/GraphGeneration/HighwayGraph.cpp +++ b/siteupdate/cplusplus/classes/GraphGeneration/HighwayGraph.cpp @@ -165,7 +165,6 @@ inline void HighwayGraph::matching_vertices_and_edges std::unordered_set rvset; // union of all sets in regions std::unordered_set svset; // union of all sets in systems std::unordered_set pvset; // set of vertices within placeradius - std::unordered_set trav_set; if (g.regions) for (Region *r : *g.regions) rvset.insert(r->vertices.begin(), r->vertices.end()); @@ -231,7 +230,11 @@ inline void HighwayGraph::matching_vertices_and_edges if (system_match) { mte.push_back(e); e->t_written[threadnum] = 1; - for (TravelerList *t : e->segment->clinched_by) trav_set.insert(t); + for (TravelerList *t : e->segment->clinched_by) + if (!t->in_subgraph[threadnum]) + { traveler_lists.push_back(t); + t->in_subgraph[threadnum] = 1; + } } } if (v->visibility < 2) continue; @@ -252,7 +255,7 @@ inline void HighwayGraph::matching_vertices_and_edges } } } - traveler_lists.assign(trav_set.begin(), trav_set.end()); + for (TravelerList* t : traveler_lists) t->in_subgraph[threadnum] = 0; traveler_lists.sort(sort_travelers_by_name); } diff --git a/siteupdate/cplusplus/classes/TravelerList/TravelerList.cpp b/siteupdate/cplusplus/classes/TravelerList/TravelerList.cpp index e36471f8..d06d57eb 100644 --- a/siteupdate/cplusplus/classes/TravelerList/TravelerList.cpp +++ b/siteupdate/cplusplus/classes/TravelerList/TravelerList.cpp @@ -18,8 +18,10 @@ TravelerList::TravelerList(std::string travname, std::string* updarr[], ErrorLis preview_systems_traveled = 0; preview_systems_clinched = 0; unsigned int list_entries = 0; + in_subgraph = new bool[args->numthreads]; traveler_num = new unsigned int[args->numthreads]; // deleted on termination of program + for (size_t i = 0; i < args->numthreads; i++) in_subgraph[i] = 0; traveler_name = travname.substr(0, travname.size()-5); // strip ".list" from end of travname if (traveler_name.size() > DBFieldLength::traveler) el->add_error("Traveler name " + traveler_name + " > " + std::to_string(DBFieldLength::traveler) + "bytes"); diff --git a/siteupdate/cplusplus/classes/TravelerList/TravelerList.h b/siteupdate/cplusplus/classes/TravelerList/TravelerList.h index 4ad02d54..b89d78e6 100644 --- a/siteupdate/cplusplus/classes/TravelerList/TravelerList.h +++ b/siteupdate/cplusplus/classes/TravelerList/TravelerList.h @@ -30,6 +30,7 @@ class TravelerList std::unordered_map active_only_mileage_by_region; // total mileage per region, active only std::unordered_map> system_region_mileages; // mileage per region per system std::unordered_set routes; + bool* in_subgraph; unsigned int *traveler_num; unsigned int active_systems_traveled; unsigned int active_systems_clinched;