Browse Source

Use refs, so we don't get copies. (clang warnings).

Steve Thielemann 3 years ago
parent
commit
92d9fe0052
1 changed files with 4 additions and 5 deletions
  1. 4 5
      galaxy.cpp

+ 4 - 5
galaxy.cpp

@@ -130,7 +130,7 @@ struct port parse_portcim(const std::string line) {
   //  20 - 1708  97% -  710  56%    287  15%
   //     [15954 - 1990 100%  20910 100%  32880 100% ]
   // SL: [ 4591 -  395  47% -15822  84%  19830 100% ]
-  
+
   static std::regex portrx(
       "[ ]*([0-9]+) (.)[ ]*([0-9]+)[ ]+([0-9]+%) (.)[ "
       "]*([0-9]+)[ ]+([0-9]+%) (.)[ ]*([0-9]+)[ ]+([0-9]+%)[ ]*",
@@ -353,10 +353,10 @@ void Galaxy::load(void) {
     if (data.contains("warps")) {
       // const json &warps = data["warps"];
       // if (warps.IsMap()) {
-      for (auto const warp_iter : data["warps"].items()) {
+      for (auto const &warp_iter : data["warps"].items()) {
         sector_warps sw;
         sw.sector = sstoi(warp_iter.key());
-        for (auto const sector_iter : warp_iter.value().items()) {
+        for (auto const &sector_iter : warp_iter.value().items()) {
           sw.add(sector_iter.value().get<int>());
         }
         // BUGZ_LOG(trace) << "YAML warp: " << sw;
@@ -1036,11 +1036,10 @@ sector_type Galaxy::find_nearest_selling(int sector, int product, int selling) {
 std::vector<sector_type> Galaxy::find_safe(void) {
   std::vector<sector_type> vst;
 
-  for( auto const & warp : warps ) {
+  for (auto const &warp : warps) {
     if (warp.second.warps.size() == 1) {
       vst.push_back(warp.first);
     }
   }
   return vst;
 }
-