فهرست منبع

Reduce the dups, only one SL SP output.

Steve Thielemann 3 سال پیش
والد
کامیت
bd124b854b
2فایلهای تغییر یافته به همراه12 افزوده شده و 8 حذف شده
  1. 12 5
      director.cpp
  2. 0 3
      session.cpp

+ 12 - 5
director.cpp

@@ -110,6 +110,7 @@ void Director::client_input(const std::string &input) {
 void Director::server_line(const std::string &line,
                            const std::string &raw_line) {
   // check for if we entered game/left game
+  if (!chain) BUGZ_LOG(info) << "SL: [" << line << "]";
 
   if (line.find("TradeWars Game Server   ") != std::string::npos) {
     // Inject our proxy activation message
@@ -248,6 +249,11 @@ void Director::server_prompt(const std::string &prompt,
   current_prompt = prompt;
   current_raw_prompt = raw_prompt;
 
+  if (!chain) {
+    std::string temp = repr(prompt);
+    BUGZ_LOG(trace) << "SP: [" << temp << "]";
+  }
+
   if (game) {
     if (prompt == "Selection (? for menu): ") {
       galaxy.save();
@@ -317,7 +323,7 @@ void Director::build_menu(void) {
 }
 
 void Director::proxy_activate(void) {
-  active = true;   // yes, set keep-alive timer.
+  active = true;                               // yes, set keep-alive timer.
   to_server(" ", "Director::proxy_active()");  // start keep-alive timer.
 
   // set other values we need
@@ -1017,7 +1023,8 @@ void Director::SL_densityline(const std::string &line) {
    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"
-  SL: [Sector ( 1704) ==>         10,350  Warps : 4    NavHaz :     0%    Anom : No]
+  SL: [Sector ( 1704) ==>         10,350  Warps : 4    NavHaz :     0%    Anom :
+  No]
   */
   if (in(line, "==>")) {
     std::string work = line;
@@ -1049,10 +1056,10 @@ void Director::SL_densityline(const std::string &line) {
       galaxy.meta["density"][sector] = YAML::Node();
     }
     */
-   // what():  [json.exception.type_error.305] cannot use operator[] with a numeric argument with object
-   // numeric argument with object 
+    // what():  [json.exception.type_error.305] cannot use operator[] with a
+    // numeric argument with object numeric argument with object
 
-   std::string sector_text = std::to_string(sector);
+    std::string sector_text = std::to_string(sector);
     galaxy.meta["_density"][sector_text]["density"] = density;
     galaxy.meta["_density"][sector_text]["warps"] = warps;
     galaxy.meta["_density"][sector_text]["navhaz"] = navhaz;

+ 0 - 3
session.cpp

@@ -152,7 +152,6 @@ void Session::on_connect(const boost::system::error_code error) {
  */
 void Session::on_server_line(const std::string &line,
                              const std::string &raw_line) {
-  BUGZ_LOG(info) << "SL: [" << line << "]";
   director.server_line(line, raw_line);
 }
 
@@ -330,8 +329,6 @@ void Session::reset_prompt_timer(void) { prompt_timer_.cancel(); }
 // probably no longer needed --
 void Session::on_server_prompt(const std::string &prompt,
                                const std::string &raw_prompt) {
-  std::string temp = repr(prompt);
-  BUGZ_LOG(trace) << "SP: [" << temp << "]";
   director.server_prompt(prompt, raw_prompt);
   if (server_telnet) {
     std::string ayt = std::string((const char *)"\x00\xff\xfd\xf6", 4);