[CODE] Players and Drunk code

From: Rodd Stenberg (stenberg@cs.curtin.edu.au)
Date: 12/10/96


Hello,
  I recently found the snippets sight and added a few things. On playing around a
bit I found my MUD crashing ;) Anyway, I started looking for the culprit/s. I have
changed players.txt because the following section of code I believe is meant to
concatenate the "\r\n" on the third column. Instead it overwrites buf and outputs a
blank line.

    if (count == 3) {
      count = 0;
      sprintf(buf, "\r\n");
    }

here is my my modified version (a few extra things were changed)

ACMD(do_players)
{
  int i, count = 0;

  sprintf(buf, "A listing of all players currently in the database:\r\n");
  for (i = 0; i <= top_of_p_table; i++)
  {
    sprintf(buf2, "  %-20.20s", (player_table + i)->name);
    strcat(buf, buf2);
    count++;
    if (count == 4)
    {
      count = 0;
      strcat(buf, "\r\n");
    }
  }
  page_string(ch->desc, buf, 1);
}

Anyway, that didn't fix my crashing problem. I think it has something to do with
the drunk code. I changed makedrunk so it just returns the same string and
it doesn't seem to crash anymore.

Anyone know what the problem is before I jump in and start playing around. It
might be the way I put it in, but I was just curious if others have had the same
problem. It doesn't like it if I go to Puff and set her drunk to 22 a few times
in quick succession. Seems to work okay when I drink alchol and talk myself
though. I think it crashes when Puff tries to talk through the spec proc. I'll
have to do some more testing though.

laters,
  Rodd

email: stenberg@cs.curtin.edu.au
+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



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