[ScryMUD] SVN Commit Info r905 - trunk/mud/grrmud/server

scrymud at wanfear.com scrymud at wanfear.com
Fri Mar 2 22:58:21 PST 2007


Author: eroper
Date: 2007-03-02 22:58:20 -0800 (Fri, 02 Mar 2007)
New Revision: 905

Modified:
   trunk/mud/grrmud/server/command2.cc
Log:
In response to: MUD-406

Both IMMs, and Players detecting hidden, will now see hidden exits listed in
their auto-exit list.

In addition, closed exits are no longer postfixed with (closed) as that was a
bit verbose. The exit name is now simply enclosed in parens.

Hidden exits are prefixed with a * which is located inside the parens of a
closed and hidden exit.

For example: (*W) E N NW
Where west is both hidden and closed.

Note: I have not yet changed the "exits" command (the much more verbose, and
non-automatic version of auto-exits) to behave this way.


Modified: trunk/mud/grrmud/server/command2.cc
===================================================================
--- trunk/mud/grrmud/server/command2.cc	2007-03-03 04:11:20 UTC (rev 904)
+++ trunk/mud/grrmud/server/command2.cc	2007-03-03 06:58:20 UTC (rev 905)
@@ -428,60 +428,85 @@
    return 0;
 }//exits()
 
+int auto_exit(critter &pc) {
 
-int auto_exit(critter& pc) { //more brief than the previous
-   Cell<door*> cll(ROOM.DOORS);
-   door* dr_ptr;
-   String buf(81);
-   String reg_disp(100);
-   String client_disp(100);
+   Cell<door*> cll(pc.getCurRoom()->doors);
+   door* door_p;
+
    int dest;
+   bool is_hidden;
+   bool can_see;
 
-   /* this function is called by 'look' btw. */
-   /* assumes the person is standing, it just entered a room... */
+   std::stringstream buf;
+   String telnet_disp(100);
+   String client_disp(100);
 
    client_disp = "< EXITS ";
-   reg_disp = cstr(CS_VIS_EXITS, pc);
-   while ((dr_ptr = cll.next())) {
-      if (detect(pc.SEE_BIT, dr_ptr->dr_data->vis_bit)) {
-         if (!((dr_ptr->isClosed() && dr_ptr->isSecret()) ||
-               dr_ptr->isSecretWhenOpen())) {
-            dest = abs(dr_ptr->destination);
-            if (pc.isImmort()) { //if immortal, show extra info
-               Sprintf(buf, "%s[%i]", abbrev_dir_of_door(*dr_ptr),
-                       dest);
-               if ( dr_ptr->isClosed() ) {
-                  buf.Append("(closed)");
-               }
-               buf.Append(" ");
-            }//if immort
-            else {
-               Sprintf(buf, "%s", abbrev_dir_of_door(*dr_ptr));
-               if ( dr_ptr->isClosed() ) {
-                  buf.Append("(closed)");
-               }
-               buf.Append(" ");
-            }//else
-            reg_disp.Append(buf);
+   telnet_disp = cstr(CS_VIS_EXITS, pc);
 
-            if (pc.USING_CLIENT) {
-               client_disp.Append(abbrev_dir_of_door(*dr_ptr));
-               client_disp.Append(" ");
-            }//if
-         }//if its open, don't show closed exits
-      }//if detect
-   }//while
+   while ( ( door_p = cll.next() ) ) {
+
+      is_hidden = false;
+      can_see = false;
+
+      dest = abs(door_p->destination);
+
+      if ( detect(pc.getSeeBit(), door_p->getVisBit()) ) {
+
+         can_see = true;
+
+         if ( ( door_p->isClosed() && door_p->isSecret() ) || door_p->isSecretWhenOpen() )  {
+
+            is_hidden = true;
+
+            if ( ! ( pc.isAffectedBy(DETECT_HIDDEN_SKILL_NUM) || pc.isImmort() ) ) {
+               can_see = false;
+            }
+         }//if hidden
+
+      } else {//see_bit isn't good enough
+         can_see = false;
+      }
+
+      if ( can_see ) {
+
+         buf.str("");
+         buf.clear();
+
+         buf << (door_p->isClosed() ? "(" : "")
+            << (is_hidden ? "*" : "")
+            << abbrev_dir_of_door(*door_p)
+            << (door_p->isClosed() ? ")" : "");
+
+         if ( pc.isImmort() && pc.shouldShowVnums() ) {
+            buf << "[" << dest << "]";
+         }
+
+         buf << " ";
+
+         telnet_disp.Append(buf.str().c_str());
+
+         if ( pc.isUsingClient() ) {
+            client_disp.Append(abbrev_dir_of_door(*door_p));
+            client_disp.Append(" ");
+         }
+
+      }//if can_see
+
+   }//while we have doors
+
    client_disp.Append(">");
-   reg_disp.Append("\n");
-   
-   pc.show(reg_disp);
-   
+   telnet_disp.Append("\n");
+
+   pc.show(telnet_disp);
+
    if (pc.USING_CLIENT) {
       pc.show(client_disp);
    }
+
    return 0;
-}//auto_exits()
 
+}//auto_exit()
 
 int lock(int i_th, const String* name, critter& pc) {
    door* dr_ptr = NULL;




More information about the ScryMUD mailing list