| 
														
															@@ -33,6 +33,7 @@ Director::Director() { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   SF_portline = [this](const std::string &s) { this->SL_portline(s); }; 
														 | 
														
														 | 
														
															   SF_portline = [this](const std::string &s) { this->SL_portline(s); }; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   SF_warpline = [this](const std::string &s) { this->SL_warpline(s); }; 
														 | 
														
														 | 
														
															   SF_warpline = [this](const std::string &s) { this->SL_warpline(s); }; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   SF_infoline = [this](const std::string &s) { this->SL_infoline(s); }; 
														 | 
														
														 | 
														
															   SF_infoline = [this](const std::string &s) { this->SL_infoline(s); }; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  SF_densityline = [this](const std::string &s) {this->SL_densityline(s); }; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   build_menu(); 
														 | 
														
														 | 
														
															   build_menu(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 } 
														 | 
														
														 | 
														
															 } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -78,7 +79,7 @@ void Director::client_input(const std::string &input) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       return; 
														 | 
														
														 | 
														
															       return; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    if (prompt == "Planet command (?=help) [D] ") { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    if (at_planet_prompt(prompt)) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       // future:  If activated at planet menu, activate the planet upgrade 
														 | 
														
														 | 
														
															       // future:  If activated at planet menu, activate the planet upgrade 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       // script! 
														 | 
														
														 | 
														
															       // script! 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       to_client("\n\r\x1b[0mFUTURE:  Activate the planet upgrade script.\n\r"); 
														 | 
														
														 | 
														
															       to_client("\n\r\x1b[0mFUTURE:  Activate the planet upgrade script.\n\r"); 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -211,6 +212,7 @@ void Director::server_line(const std::string &line, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     if (startswith(line, " Items     Status  Trading % of max OnBoard")) 
														 | 
														
														 | 
														
															     if (startswith(line, " Items     Status  Trading % of max OnBoard")) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       SL_parser = SF_portline; 
														 | 
														
														 | 
														
															       SL_parser = SF_portline; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     */ 
														 | 
														
														 | 
														
															     */ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    if (in(line, "==>")) SL_parser = SF_densityline; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     if (startswith(line, "Sector  : ")) SL_parser = SF_sectorline; 
														 | 
														
														 | 
														
															     if (startswith(line, "Sector  : ")) SL_parser = SF_sectorline; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     if (line == ": ") SL_parser = SF_cimline; 
														 | 
														
														 | 
														
															     if (line == ": ") SL_parser = SF_cimline; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     if (line == "<Info>") SL_parser = SF_infoline; 
														 | 
														
														 | 
														
															     if (line == "<Info>") SL_parser = SF_infoline; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -819,6 +821,62 @@ void Director::SL_sectorline(const std::string &line) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   } 
														 | 
														
														 | 
														
															   } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 } 
														 | 
														
														 | 
														
															 } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+void Director::SL_densityline(const std::string &line) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  BUGZ_LOG(fatal) << "densityline: [" << line << "]"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  if(line.empty()) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    SL_parser = nullptr; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    return; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  // Ensure this really is a density scan and not something else 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  if(not in(line, "Sector") or not in(line, "Warps") or not in(line, "NavHaz") or not 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" 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  // Cleaned up line 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+   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::string work = line; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  replace(work, ":", ""); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  bool known = not in(work, "("); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  replace(work, "(", ""); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  replace(work, ")", ""); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  replace(work, "%", ""); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  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 << "}"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  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) { 
														 | 
														
														 | 
														
															 void Director::SL_portline(const std::string &line) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   /* 
														 | 
														
														 | 
														
															   /* 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   We take blank lines because we start at <Port>. 
														 | 
														
														 | 
														
															   We take blank lines because we start at <Port>. 
														 |