diff --git a/cache.cpp b/cache.cpp index ab334bf..8352a30 100644 --- a/cache.cpp +++ b/cache.cpp @@ -28,7 +28,7 @@ void Cache::set_date(const std::tm* t) { date_tm = *t; std::mktime(&date_tm); - year = std::to_string(1900+date_tm.tm_year); + year = std::to_string(1900 + date_tm.tm_year); std::strftime(tmp, 20, "(%m) %B", &date_tm); mon = tmp; day = std::to_string(date_tm.tm_mday); @@ -38,7 +38,7 @@ void Cache::set_date(const std::tm* t) { std::strftime(tmp, 20, "%F", &date_tm); date = tmp; -// date += std::to_string(date_tm.tm_hour) + ":" + std::to_string(date_tm.tm_min) + ":" + std::to_string(date_tm.tm_sec); + //date += std::to_string(date_tm.tm_hour) + ":" + std::to_string(date_tm.tm_min) + ":" + std::to_string(date_tm.tm_sec); } float cache_distance(const Cache& a, const Cache& b) { diff --git a/geostat.cpp b/geostat.cpp index 177903c..d24f7ea 100644 --- a/geostat.cpp +++ b/geostat.cpp @@ -68,7 +68,7 @@ void show_histogram(Caches* cc, std::string Cache::*ptr, std::string caption, bo std::cout << "
\n"; for (auto own : pairs) { if (own.first.empty()) own.first = "[unknown]"; - while ((n = own.first.find('&', n+1)) != std::string::npos) + while ((n = own.first.find('&', n + 1)) != std::string::npos) own.first.replace(n, 1, "&"); if (i < HIST_MAX) @@ -144,25 +144,30 @@ int main(int argc, char** argv) { bool use_oc = 0; bool use_ocpl_db = 0; bool get_not_found = 0; + std::string ocpl_user; std::string ocde_user; std::string ocus_user; std::string ocnl_user; std::string ocro_user; std::string ocuk_user; + std::string ocpl_user_profile; std::string ocde_user_profile; std::string ocus_user_profile; std::string ocnl_user_profile; std::string ocro_user_profile; std::string ocuk_user_profile; + std::string ocpl_url = "https://opencaching.pl/okapi/"; std::string ocde_url = "https://www.opencaching.de/okapi/"; std::string ocus_url = "http://www.opencaching.us/okapi/"; std::string ocnl_url = "http://www.opencaching.nl/okapi/"; std::string ocro_url = "http://www.opencaching.ro/okapi/"; std::string ocuk_url = "https://opencache.uk/okapi/"; + const std::string Database = "ocpl.sqlite"; + std::string gpx_file; #include "config_user.h" @@ -183,7 +188,7 @@ int main(int argc, char** argv) { // std::cout << "Option \"-d\" requires a valid number as an argument\n"; // std::exit(EXIT_FAILURE); // } -// break; + // break; case 'g': gpx_file = optarg; break; @@ -376,7 +381,7 @@ int main(int argc, char** argv) { dates[i.date]++; if (i.type != "Moving" && i.type != "Own") { tmp = i.date_tm; - sorted_caches.insert({std::mktime(&tmp), &i}); + sorted_caches.insert({ std::mktime(&tmp), &i }); } } auto best_day = std::max_element(dates.begin(), dates.end(), [&](auto& a, auto& b) { return a.second < b.second; }); @@ -396,10 +401,10 @@ int main(int argc, char** argv) { int tot_dist = 0; for (auto i = sorted_caches.begin(); i != std::prev(sorted_caches.end()); i++) { -// std::cout << "Distance between " << i->second->name << " and " << std::next(i)->second->name << " is " << cache_distance(*i->second, *std::next(i)->second) << "
"; + //std::cout << "Distance between " << i->second->name << " and " << std::next(i)->second->name << " is " << cache_distance(*i->second, *std::next(i)->second) << "
"; tot_dist += cache_distance(*i->second, *std::next(i)->second); } - std::cout << "Total distance between caches: " << tot_dist << " km (equivalent to " << tot_dist/(2 * Pi * Earth_radius) << "x trips around Earth)
\n"; + std::cout << "Total distance between caches: " << tot_dist << " km (equivalent to " << tot_dist / (2 * Pi * Earth_radius) << "x trips around Earth)
\n"; std::cout << "Average distance between caches: " << tot_dist / sorted_caches.size() << " km
\n"; std::cout << "\n"; } @@ -518,9 +523,8 @@ int main(int argc, char** argv) { } std::cout << "\n"; std::cout << "
\n"; - std::cout << "Total " << n << " combinations found out of 81 (" << std::setprecision(3) << n/0.81 << "%).\n"; + std::cout << "Total " << n << " combinations found out of 81 (" << std::setprecision(3) << n / 0.81 << "%).\n"; std::cout << "
\n"; - } if (show_html) { diff --git a/okapi.cpp b/okapi.cpp index e61f63e..d4bc115 100644 --- a/okapi.cpp +++ b/okapi.cpp @@ -110,10 +110,9 @@ Caches Okapi::get_caches(std::vector> codes) { uint k = 0; while (n < codes.size()) { std::string codes_list; - codes_list.reserve(500*7); + codes_list.reserve(500 * 7); k = 0; -// int n = (codes.size() > 500) ? 500 : cc.codes(); while (n < codes.size() && k < 500) { codes_list += codes.at(n).first; codes_list += '|';