[Code] To Dark to see??

From: Mort (bg214884@STMAIL.STAFFS.AC.UK)
Date: 08/06/98


Hello - I am the coder for Terminus (currently in need of a new home) a MUD
based on Circle MUD. We have changed the do_auto_exit function to make it
look a bit nicer and I was wondering if there was anyone out there that
could help me fix the latest problem. We wanted it to say that the room in
a named direction was Dark (ie. by putting Too Dark to See in place of the
name of the nearby room). We have tried a number of things out but we can
not get it to take into account if the person is carrying a light source of
some description. If there is anyone out there that has any Ideas I would
be grateful for some help.
The code for this function follows.

void do_auto_exits(struct char_data * ch)
{
  int door;
  char tmpBuf[10];
  char temp[80]; /* used to bung things in Mort*/
  *buf = '\0';
  for (door = 0; door < NUM_OF_DIRS; door++)
    if (EXIT(ch, door) && EXIT(ch, door)->to_room != NOWHERE &&
        !IS_SET(EXIT(ch, door)->exit_info, EX_CLOSED)) {
         switch(LOWER(*dirs[door])) {
         case 'n': strcpy(tmpBuf, "north"); break;

         case 'e': strcpy(tmpBuf, "east"); break;

         case 's': strcpy(tmpBuf, "south"); break;

         case 'w': strcpy(tmpBuf, "west"); break;

         case 'u': strcpy(tmpBuf, "up"); break;

         case 'd': strcpy(tmpBuf, "down"); break;

         default: strcpy(tmpBuf, "somewhere");
         };
         /* added to take into account dark rooms */
         if(IS_SET(ROOM_FLAGS(EXIT(ch, door)->to_room), ROOM_DARK)) {
           strcpy(temp, "Too dark to see");
         }
         else {
           strcpy(temp, world[EXIT(ch,door)->to_room].name);
         }
         /* End added section, change line below as well though*/
         sprintf(buf, "^p%10s^N: ^Y%s\r\n", tmpBuf, /*world[EXIT(ch,
door)->to_room].name*/ temp);
         send_to_char(buf, ch);
    };

}

Note. The ^Y etc bits are for out colouring instead of using ANSI codes.

Mort


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST