Quellcode durchsuchen

Fixed input (color bleeding). Proxy active prompt.

Steve Thielemann vor 3 Jahren
Ursprung
Commit
7e5bc443b8
1 geänderte Dateien mit 22 neuen und 13 gelöschten Zeilen
  1. 22 13
      dispatchers.cpp

+ 22 - 13
dispatchers.cpp

@@ -15,7 +15,6 @@ const std::string &Dispatch::get_prompt(void) { return sess->get_prompt(); }
 
 void Dispatch::setNotify(notifyFunc nf) { notify_ = nf; }
 
-
 void Dispatch::notify(void) {
   if (notify_) {
     sess->post(notify_);
@@ -40,20 +39,26 @@ void MainDispatch::activate(void) {
   sess->talk_direct = false; // do not auto-send client to server
   count = 0;
   old_prompt = sess->get_prompt();
-  Boxes box(40, 1, true);
+
+  /*
+  ╔══════════════════════════════╗
+  ║    TradeWars Proxy Active    ║
+  ╚══════════════════════════════╝
+     -=>
+  */
+
+  Boxes box(30, 1, true);
   box.boxcolor = "\x1b[1;33;44m";
-  box.textcolor = "\x1b[1;37;44m";
+  box.textcolor = "\x1b[1;33;44m";
   to_client("\n\r");
   to_client(box.top());
-  std::string output = "Proxy ACTIVE! Welcome!";
-  while (output.length() < 40)
-    output.append(" ");
-
+  std::string output = "    TradeWars Proxy \x1b[5mActive\x1b[0;1;33;44m    ";
   to_client(box.row(output));
   to_client(box.bottom());
-  to_client("\n\r\x1b[1;34mWELCOME!  You are now in the proxy zone...\n\r");
-  id.prompt = "Proxy Main :=> ";
-  id.max_length = 25;
+
+  // to_client("\n\r\x1b[1;34mWELCOME!  You are now in the proxy zone...\n\r");
+  id.prompt = "\x1b[0m    \x1b[1;33;44m-=>\x1b[0m \x1b[1;37;44m";
+  id.max_length = 5;
   id.setNotify([this]() { this->have_input(); });
   id.activate();
 }
@@ -62,9 +67,13 @@ void MainDispatch::have_input(void) {
   ++count;
   std::string output =
       str(boost::format("Your Input (%2%): [%1%]\n\r") % id.input % count);
-
+  to_client("\x1b[0m");
   to_client(output);
-  if (count >= 5) {
+  if (id.input == "?") {
+    // Maybe?  Maybe not.
+  }
+  if (id.input.empty()) {
+  // if (count >= 5) {
     auto lines = Boxes::alert(" Returning you to the game... ", "",
                               "\x1b[1;32m", 30, 1, true);
     // I'm not setting the box color, so the last color bleeds over.
@@ -166,7 +175,7 @@ void InputDispatch::client_input(const std::string &cinput) {
     } else if (ch == '\r') {
       // Ok, we're done!
       BUGZ_LOG(info) << "InputDispatch done: " << input;
-      to_client("\n\r");
+      to_client("\x1b[0m\n\r");
       deactivate();
     }
   }