Problems with my Scan skill/command

From: Rasmus R\xnlev (
Date: 10/27/95

After several days of headache, and tons of coffee (soemthing like that 
:), I decided to see if someone on this list could solve my lousy coding 
of the mentioned SCAN command.

Basicaly I just added it as a ACMD, so that all players could use it, 
just to avoid confusion.
Now I looked at the do_exit procedure, and a little at the room-file 
structure, and to me it seems, that this piece of code should work fine...

[Code begins]
 struct char_data *i, *list;
 struct room_data *world;
 int door;

  sprintf(buf, "You're blinded and can't see a damn thing!");
  act(buf, FALSE, ch, 0, 0, TO_CHAR);

 *buf = '\0';

 for (door = 0; door < NUM_OF_DIRS; door++)
  if (EXIT(ch, door))
   sprintf("%sEXIT(ch, door) = %d\r\n", buf, door);
   if(EXIT(ch, door)->to_room != NOWHERE)
    if(!IS_SET(EXIT(ch, door)->exit_info, EX_CLOSED))
     sprintf(buf, "%sGennemloeb, door open = %d\r\n",buf, door);
    if(IS_SET(EXIT(ch, door)->exit_info, EX_CLOSED))
     sprintf(buf, "%sGennemloeb, door closed = %d\r\n",buf, door);
   if(list = (world[EXIT(ch, door)->to_room].people))
    sprintf(buf, "%s      Room is empty.\r\n", buf);
    sprintf(buf, "%s      Room has inhabitents!\r\n.", buf);
    for (i = list; i; i = i->next_in_room)
     if(ch != i)
      sprintf(buf, "%s      %s\r\n", buf, i->;
 send_to_char("Scanned exits:\r\n", ch);

 if (*buf)
  send_to_char(buf, ch);
  send_to_char(" None.\r\n", ch);

[Code Ends!]

Well, as a starter I NEVER get a TRUE on the:  

if(EXIT(ch, door)->to_room != NOWHERE)

I don't know why... 
Anyways, as I had it biuld a little different, with the same structure 
withing that if statement, I seg-faulted all the time... 
So, in general I guess it's lousy code... BUT, I can't see why it's not 

Anyone got some bright ideas, as to whats wrong in the code ?


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