diff --git a/siteupdate/cplusplus/classes/ClinchedSegmentEntry.cpp b/siteupdate/cplusplus/classes/ClinchedSegmentEntry.cpp deleted file mode 100644 index f7011425..00000000 --- a/siteupdate/cplusplus/classes/ClinchedSegmentEntry.cpp +++ /dev/null @@ -1,22 +0,0 @@ -class ClinchedSegmentEntry -{ /* This class encapsulates one line of a traveler's list file - - raw_line is the actual line from the list file for error reporting - - route is a pointer to the route clinched - - start and end are indexes to the point_list vector in the Route object, - in the same order as they appear in the route decription file - */ - public: - //std::string raw_line; // Implemented but unused in siteupdate.py. Commented out to conserve RAM. - Route *route; - unsigned int start, end; - - ClinchedSegmentEntry(/*std::string line,*/ Route *r, unsigned int start_i, unsigned int end_i) - { //raw_line = line; - route = r; - start = start_i; - end = end_i; - } -}; diff --git a/siteupdate/cplusplus/classes/TravelerList/TravelerList.cpp b/siteupdate/cplusplus/classes/TravelerList/TravelerList.cpp index a1e65ba4..58069515 100644 --- a/siteupdate/cplusplus/classes/TravelerList/TravelerList.cpp +++ b/siteupdate/cplusplus/classes/TravelerList/TravelerList.cpp @@ -12,7 +12,6 @@ class TravelerList public: std::mutex ap_mi_mtx, ao_mi_mtx, sr_mi_mtx; std::unordered_set clinched_segments; - std::list list_entries; std::string traveler_name; std::unordered_map active_preview_mileage_by_region; // total mileage per region, active+preview only std::unordered_map active_only_mileage_by_region; // total mileage per region, active only @@ -35,6 +34,7 @@ class TravelerList active_systems_clinched = 0; preview_systems_traveled = 0; preview_systems_clinched = 0; + unsigned int list_entries = 0; traveler_num = new unsigned int[args->numthreads]; // deleted on termination of program traveler_name = travname.substr(0, travname.size()-5); // strip ".list" from end of travname @@ -133,8 +133,7 @@ class TravelerList // r is a route match, r.root is our root, and we need to find // canonical waypoint labels, ignoring case and leading // "+" or "*" when matching - std::list canonical_waypoints; - std::vector canonical_waypoint_indices; + std::vector point_indices; unsigned int checking_index = 0; for (Waypoint *w : r->point_list) { std::string lower_label = lower(w->label); @@ -142,8 +141,7 @@ class TravelerList lower(fields[3]); while (lower_label.front() == '+' || lower_label.front() == '*') lower_label.erase(lower_label.begin()); if (fields[2] == lower_label || fields[3] == lower_label) - { canonical_waypoints.push_back(w); - canonical_waypoint_indices.push_back(checking_index); + { point_indices.push_back(checking_index); r->liu_mtx.lock(); r->labels_in_use.insert(upper(lower_label)); r->liu_mtx.unlock(); @@ -152,8 +150,7 @@ class TravelerList { lower_label = lower(alt); while (lower_label.front() == '+') lower_label.erase(lower_label.begin()); if (fields[2] == lower_label || fields[3] == lower_label) - { canonical_waypoints.push_back(w); - canonical_waypoint_indices.push_back(checking_index); + { point_indices.push_back(checking_index); r->liu_mtx.lock(); r->labels_in_use.insert(upper(lower_label)); r->liu_mtx.unlock(); @@ -166,7 +163,7 @@ class TravelerList } checking_index++; } - if (canonical_waypoints.size() != 2) + if (point_indices.size() != 2) { bool invalid_char = 0; for (size_t c = 0; c < trim_line.size(); c++) if (trim_line[c] < 0x20 || trim_line[c] >= 0x7F) @@ -178,11 +175,11 @@ class TravelerList log << '\n'; splist << orig_line << endlines[l]; } - else { list_entries.emplace_back(/**line,*/ r, canonical_waypoint_indices[0], canonical_waypoint_indices[1]); + else { list_entries++; // find the segments we just matched and store this traveler with the // segments and the segments with the traveler (might not need both // ultimately) - for (unsigned int wp_pos = canonical_waypoint_indices[0]; wp_pos < canonical_waypoint_indices[1]; wp_pos++) + for (unsigned int wp_pos = point_indices[0]; wp_pos < point_indices[1]; wp_pos++) { HighwaySegment *hs = r->segment_list[wp_pos]; hs->add_clinched_by(this); clinched_segments.insert(hs); @@ -204,7 +201,7 @@ class TravelerList } } delete[] listdata; - log << "Processed " << list_entries.size() << " good lines marking " << clinched_segments.size() << " segments traveled.\n"; + log << "Processed " << list_entries << " good lines marking " << clinched_segments.size() << " segments traveled.\n"; log.close(); splist.close(); } diff --git a/siteupdate/cplusplus/classes/TravelerList/splitregion.cpp b/siteupdate/cplusplus/classes/TravelerList/splitregion.cpp index e2a38dfe..07ab5859 100644 --- a/siteupdate/cplusplus/classes/TravelerList/splitregion.cpp +++ b/siteupdate/cplusplus/classes/TravelerList/splitregion.cpp @@ -2,7 +2,7 @@ if (args->splitregion == upper(fields[0])) { // first, comment out original line splist << "##### " << orig_line << newline; - HighwaySegment *orig_hs = r->segment_list[canonical_waypoint_indices[0]]; + HighwaySegment *orig_hs = r->segment_list[point_indices[0]]; HighwaySegment *new_hs = 0; if (!orig_hs->concurrent) std::cout << "ERROR: " << orig_hs->str() << " not concurrent" << std::endl; @@ -17,10 +17,7 @@ if (args->splitregion == upper(fields[0])) else { if (count > 1) std::cout << "DEBUG: multiple matches found for " << orig_hs->str() << std::endl; // get lines from associated connected route. // assumption: each chopped route in old full region corresponds 1:1 to a connected route in new chopped regions - splist << new_hs->route->con_route->list_lines(canonical_waypoint_indices[0], - canonical_waypoint_indices[1] - - canonical_waypoint_indices[0], - newline, 2) << endlines[l]; + splist << new_hs->route->con_route->list_lines(point_indices[0], point_indices[1] - point_indices[0], newline, 2) << endlines[l]; } } } diff --git a/siteupdate/cplusplus/functions/lower.cpp b/siteupdate/cplusplus/functions/lower.cpp index 9f5e58e2..228d0cde 100644 --- a/siteupdate/cplusplus/functions/lower.cpp +++ b/siteupdate/cplusplus/functions/lower.cpp @@ -4,10 +4,8 @@ std::string lower(std::string str) return str; } -//#ifdef TravelerList__cstr char *lower(char *str) { for (char *c = str; *c != 0; c++) if (*c >= 'A' && *c <= 'Z') *c += 32; return str; } -//#endif diff --git a/siteupdate/cplusplus/siteupdate.cpp b/siteupdate/cplusplus/siteupdate.cpp index 80455530..db677b9f 100644 --- a/siteupdate/cplusplus/siteupdate.cpp +++ b/siteupdate/cplusplus/siteupdate.cpp @@ -61,7 +61,6 @@ class HGEdge; #include "classes/Waypoint/Waypoint.h" #include "classes/Waypoint/Waypoint.cpp" #include "classes/WaypointQuadtree/WaypointQuadtree.cpp" -#include "classes/ClinchedSegmentEntry.cpp" #include "classes/HighwaySegment/HighwaySegment.h" #include "classes/ClinchedDBValues.cpp" #include "classes/Route/Route.cpp"