ソースを参照

Added information to show ports/warps counts.

Steve Thielemann 3 年 前
コミット
e7c603e2bc
2 ファイル変更31 行追加8 行削除
  1. 29 8
      director.cpp
  2. 2 0
      director.h

+ 29 - 8
director.cpp

@@ -243,10 +243,15 @@ void Director::build_menu(void) {
       "\x1b[0;31;40m\xdb\xb2\xb1\xb0 \x1b[31;40mRED "
       "\x1b[32;40mGREEN\x1b[30;42m\xdb\xb2\xb1\xb0 \x1b[0m : ";
   md->lazy = true;
-  md->menu = {{"C", "Configure"},        {"D", "Display Report"},
-              {"E", "Export Data/Save"}, {"P", "Port CIM"},
-              {"W", "Warp CIM"},         {"T", "Trading Report"},
-              {"S", "Scripts"},          {"X", "eXit"}};
+  md->menu = {{"C", "Configure"},
+              {"D", "Display Report"},
+              {"E", "Export Data/Save"},
+              {"I", "Information"},
+              {"P", "Port CIM"},
+              {"W", "Warp CIM"},
+              {"T", "Trading Report"},
+              {"S", "Scripts"},
+              {"X", "eXit"}};
   md->setNotify([this]() { this->menu_choice(); });
 
   cim = std::make_shared<CIMDispatch>(*this);
@@ -316,8 +321,12 @@ void Director::menu_choice(void) {
           galaxy.save();
           to_client("\rSaved....\n\r");
           break;
+        case 'I':  // Information
+          information();
+          break;
         case 'P':  // Port CIM
-          // TO FIX: Save type 0 & 9 ports, and restore!
+          // Since we're adding/updating, we don't lose our
+          // type 0 ports.  Type 9 stays at 9.
           chain = cim;
           to_server("^RQ");
           to_client("Port CIM Report\n\r");
@@ -339,9 +348,11 @@ void Director::menu_choice(void) {
           proxy_deactivate();
           return;
       }
+      /*
       std::string text = str(
           boost::format("Back from Menu [%1%] was selected.\n\r") % md->input);
       to_client(text);
+      */
 
       md->activate();
     }
@@ -373,6 +384,16 @@ void Director::cim_done(void) {
   main_menu->activate();
 }
 
+void Director::information(void) {
+  std::string output;
+  to_client("I currently know the following:\n\r");
+  output = str(
+      boost::format("Ports: %1%, Sectors: %2%, Config: %3%, Meta: %4%\n\r") %
+      galaxy.ports.size() % galaxy.warps.size() % galaxy.config.size() %
+      galaxy.meta.size());
+  to_client(output);
+}
+
 void Director::proxy_deactivate(void) {
   active = false;
   // reset everything back to good state
@@ -417,11 +438,11 @@ void Director::SL_cimline(const std::string &line) {
     if (p.sector == 0)
       BUGZ_LOG(fatal) << "portcim:  FAIL [" << line << "]";
     else
-      BUGZ_LOG(fatal) << "portcim: " << p;
+      BUGZ_LOG(trace) << "portcim: " << p;
     galaxy.add_port(p);
   } else {
     // warpcim
-    BUGZ_LOG(fatal) << "warpcim: [" << line << "]";
+    // BUGZ_LOG(fatal) << "warpcim: [" << line << "]";
     auto warps = split(line);
     sector_warps sw;
     for (auto const &w : warps) {
@@ -431,7 +452,7 @@ void Director::SL_cimline(const std::string &line) {
         sw.add(stoi(w));
       }
     }
-    BUGZ_LOG(fatal) << "warpcim: " << sw;
+    BUGZ_LOG(trace) << "warpcim: " << sw;
     galaxy.add_warp(sw);
   }
 }

+ 2 - 0
director.h

@@ -60,6 +60,8 @@ class Director {
   void menu_choice(void);
   void cim_done(void);
 
+  void information(void);
+  
   StringFunc SL_parser;
   StringFunc SF_cimline, SF_sectorline, SF_portline, SF_warpline;