[Code] Looping through Mobs.

From: Ryan Gasper or Steven Arnold (dalamar@CYBERCOM.NET)
Date: 07/15/98

  Could someone please tell me why the below code is not working? I have
gone over it and put in some log checks, but cannot find out why its not
working. I believe that after a mob vnum is equal to masters[i].master,
it does not kick out of the loop correctly and mob is changed.

  for (mob = world[ch->in_room].people; mob || !found; mob = mob->next_in_room)
    for (i = 0; masters[i].master != -1; i++) {
      sprintf(buf, "MOB Found, VNUM = %d", GET_MOB_VNUM(mob));
      if (GET_MOB_VNUM(mob) == masters[i].master)
        found = TRUE;
        log("Second Step Complete");
log("Beginning of Step 3");
  if (!mob) {
    send_to_char("There is no one here to train you.\r\n", ch);

I get the message "There is no one here to train you" even though above I
get Second Step complete meaning mob cannot be !mob. Also, if I add in a
Check for the mobs vnum right after Beginning of step 3 log, it crashes
with a seg fault. Anyone have any ideas?

        _\|/_____________________________\|/_ Ryan Lane Gasper _\|/_
         /|"You will never see me cause    \/------------------\/|\
          | I'm always alone" -Ministry      dalamar@cybercom.net|
          |"The tree of liberty must be refreshed from time to   |
         /|\                     -*-1997-*-                     /|\

     | 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