| 
					
				 | 
			
			
				@@ -34,6 +34,9 @@ Director::Director() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   SF_warpline = [this](const std::string &s) { this->SL_warpline(s); }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   SF_infoline = [this](const std::string &s) { this->SL_infoline(s); }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   SF_densityline = [this](const std::string &s) { this->SL_densityline(s); }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  SF_computer_portline = [this](const std::string &s) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this->SL_computer_portline(s); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   build_menu(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -212,14 +215,18 @@ void Director::server_line(const std::string &line, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (startswith(line, " Items     Status  Trading % of max OnBoard")) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       SL_parser = SF_portline; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    if (in(line, "==>")) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      SL_parser = SF_densityline; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    if (startswith(line, "Sector  : ")) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      SL_parser = SF_sectorline; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    if (line == ": ") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      SL_parser = SF_cimline; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    if (line == "<Info>") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      SL_parser = SF_infoline; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (endswith(line, "Relative Density Scan")) SL_parser = SF_densityline; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (startswith(line, "Sector  : ")) SL_parser = SF_sectorline; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (line == ": ") SL_parser = SF_cimline; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (line == "<Info>") SL_parser = SF_infoline; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (startswith(line, "What sector is the port in? [")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      // Computer Port Report 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      // SL: [What sector is the port in? [611] 4] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      size_t pos = line.rfind(' '); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      computer_port_sector = stoi(line.substr(pos)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      SL_parser = SF_computer_portline; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   if (SL_parser) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -468,7 +475,10 @@ MenuDispatch *Director::init_scripts_menu(void) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     md->menu_options_color = "\x1b[1;32;40m"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     md->lazy = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     md->menu_prompt = " SCRIPT : "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    md->menu = {{"!", "Terror"}, {"T", "Trade"}, {"U", "Upgrade Planet Pants"}}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    md->menu = {{"!", "Terror"}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                {"T", "Trade"}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                {"S", "Safe Move"}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                {"U", "Upgrade Planet Pants"}}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     md->setNotify([this]() { this->scripts_done(); }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return md; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -499,32 +509,28 @@ void Director::scripts_done(void) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               "No Trades found.  Port burnt (CONFIG: lower burnt_percent?) " 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               "or no ports around.\n\r"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           proxy_deactivate(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          return; } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        case 'S': { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          script = std::make_shared<MoveDispatch>(*this); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          MoveDispatch *md = static_cast<MoveDispatch *>(&((*script))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          md->setNotify([this]() { this->proxy_deactivate(); }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          md->move_to = 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          chain = script; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          chain->activate(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        // sort first? 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        galaxy.sort_port_pair_type(found); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        BUGZ_LOG(fatal) << "Found " << found.size() << " possible trade(s)."; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        BUGZ_LOG(fatal) << found[0].s1 << "," << found[0].s2 << " : " 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        << found[0].type; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        ts->port[0] = found[0].s1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        ts->port[1] = found[0].s2; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        ts->type = found[0].type; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        chain = script; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        chain->activate(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      } break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      case '!': { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        auto best = galaxy.find_closest(current_sector); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (best.type != 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          std::string text = 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              str(boost::format("Best/Closest: %1% with %2% & %3%\n\r") % 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                  best.type % best.s1 % best.s2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          to_client(text); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          to_client("I don't see any best trades.\n\r"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      } break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        case '!': { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          auto best = galaxy.find_closest(current_sector); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          if (best.type != 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            std::string text = 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                str(boost::format("Best/Closest: %1% with %2% & %3%\n\r") % 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    best.type % best.s1 % best.s2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            to_client(text); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            to_client("I don't see any best trades.\n\r"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -819,6 +825,7 @@ void Director::SL_sectorline(const std::string &line) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       sector_warps sw; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       auto warps = split(temp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       sw.sector = current_sector; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      // what if there is only one warp? 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       for (auto const &w : warps) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         sw.add(stoi(w)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -834,49 +841,57 @@ void Director::SL_densityline(const std::string &line) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     SL_parser = nullptr; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   // Ensure this really is a density scan and not something else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  if (!in(line, "Sector") || !in(line, "Warps") || 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      !in(line, "NavHaz") || !in(line, "Anom")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  if (!in(line, "Sector") || !in(line, "Warps") || !in(line, "NavHaz") || 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      !in(line, "Anom")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     BUGZ_LOG(fatal) << "densityline: Invalid line."; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     SL_parser = nullptr; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  if (not galaxy.meta["density"]) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    galaxy.meta["density"] = YAML::Node(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    0         1   2                3  4     5 6    7      8     9     10   11 12 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   "Sector    55  ==>              0  Warps : 4    NavHaz :     0%    Anom : No" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   "Sector ( 223) ==>              0  Warps : 3    NavHaz :     0%    Anom : No" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  std::string work = line; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  replace(work, ":", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  bool known = !in(work, "("); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  replace(work, "(", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  replace(work, ")", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  replace(work, "%", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  // Cleaned up 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-   0      1  2   3 4     5 6      7 8    9 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  "Sector 55 ==> 0 Warps 4 NavHaz 0 Anom No" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  "Sector 223 ==> 0 Warps 3 NavHaz 0 Anom No" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  std::vector<std::string> dense = split(work); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  // Parse our data 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  int sector = std::stoi(dense.at(1)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  int density = std::stoi(dense.at(3)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  int warps = std::stoi(dense.at(5)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  int navhaz = std::stoi(dense.at(7)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  bool anom = in(dense.at(9), "Yes"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  // Commit data 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  BUGZ_LOG(warning) << "densityline: {sector=" << sector 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    << " density=" << density << " warps=" << warps 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    << " navhaz=" << navhaz << " anom=" << anom 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    << " known=" << known << "}"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  galaxy.meta["density"][sector]["density"] = density; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  galaxy.meta["density"][sector]["warps"] = warps; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  galaxy.meta["density"][sector]["navhaz"] = navhaz; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  galaxy.meta["density"][sector]["anom"] = anom; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  galaxy.meta["density"][sector]["known"] = known; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  // Add a check to see if density is greater than 500 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  // Add datetime stamp 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  if (in(line, "==>")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    std::string work = line; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    replace(work, ":", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    bool known = !in(work, "("); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    replace(work, "(", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    replace(work, ")", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    replace(work, "%", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    auto dense = split(work); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // Parse our data 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    int sector = std::stoi(dense.at(1)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    int density = std::stoi(dense.at(3)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    int warps = std::stoi(dense.at(5)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    int navhaz = std::stoi(dense.at(7)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    bool anom = in(dense.at(9), "Yes"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // Commit data 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    BUGZ_LOG(warning) << "densityline: {sector=" << sector 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                      << " density=" << density << " warps=" << warps 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                      << " navhaz=" << navhaz << " anom=" << anom 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                      << " known=" << known << "}"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (galaxy.meta["density"][sector]) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      galaxy.meta["density"][sector] = YAML::Node(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    galaxy.meta["density"][sector]["density"] = density; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    galaxy.meta["density"][sector]["warps"] = warps; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    galaxy.meta["density"][sector]["navhaz"] = navhaz; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    galaxy.meta["density"][sector]["anom"] = anom; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    galaxy.meta["density"][sector]["known"] = known; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // Add a check to see if density is greater than 500 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // Add datetime stamp 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 void Director::SL_portline(const std::string &line) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1056,4 +1071,62 @@ void Director::SL_infoline(const std::string &line) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     galaxy.meta["info"][key] = value; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     BUGZ_LOG(fatal) << "Info: " << key << " : " << value; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+void Director::SL_computer_portline(const std::string &line) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  if (startswith(line, "What sector is the port in?")) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    computer_port_done = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  if (line == "I have no information about a port in that sector.") { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    computer_port_sector = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    SL_parser = nullptr; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  if (!computer_port_done) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (in(line, "Fuel Ore")) computer_port_done = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (in(line, "Cargo holds")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      // If I want to scan the class type 0 ports: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      // computer_port_done = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      // otherwise: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      SL_parser = nullptr; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  if (computer_port_done) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (line.empty()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      SL_parser = nullptr; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // scan for items of interest 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // SL: [Fuel Ore   Buying     810    100%       0] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // SL: [Organics   Buying     856     57%       0] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // SL: [Equipment  Selling    922     44%       0] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    std::string work = line; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    replace(work, "Fuel Ore", "Fuel"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    replace(work, "%", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    auto parts = split(work); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    char c = tolower(parts[0][0]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    int pos; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    char foe[4] = "foe"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    for (pos = 0; pos < 3; ++pos) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      if (c == foe[pos]) break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    int amount = stoi(parts[2]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    int percent = stoi(parts[3]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // update port 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    auto port = galaxy.ports.find(computer_port_sector); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (port != galaxy.ports.end()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      BUGZ_LOG(info) << "COM PORT " << computer_port_sector << " " << c << " " 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                     << amount << " " << percent; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      port->second.amount[pos] = amount; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      port->second.percent[pos] = percent; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 |