Re: [Code] spell name is hanging the MUD

From: George (greerga@circlemud.org)
Date: 11/27/98


On Fri, 27 Nov 1998, The Realms of Tremaria wrote:

>Also, Mr. Greer metioned that log() entries are my best friend.  I agree,
>for that is how I resolved where the problem was occuring and what the
>problem is.  log() entries do not tell me why things happen as they do,
>and that is what I am really looking for so I can correct these errors
>before they happen.

Ok, I'll be a bit more explicit:

void say_spell(struct char_data * ch, int spellnum, struct char_data * tch,
                    struct obj_data * tobj)
{
  char lbuf[256];

  struct char_data *i;
  int j, ofs = 0;

  *buf = '\0';
  strcpy(lbuf, spells[spellnum]);

  log("Starting the loop. (%d)", time());

  while (*(lbuf + ofs)) {

    log("String left='%s' ofs=%d", lbuf + ofs, ofs);

    for (j = 0; *(syls[j].org); j++) {
      if (!strncmp(syls[j].org, lbuf + ofs, strlen(syls[j].org))) {
        strcat(buf, syls[j].news);
        ofs += strlen(syls[j].org);
      }
    }
  }

  log("It's not the loop, honest. (%d)", time());

  if (tch != NULL && tch->in_room == ch->in_room) {
[...etc...]

Then whatever the first character of 'string left' is repeatedly is your
problem.

So you'll probably want to add that to the table.

--
George Greer, greerga@circlemud.org | Genius may have its limitations, but
http://mouse.van.ml.org/   (mostly) | stupidity is not thus handicapped.
http://www.van.ml.org/CircleMUD/    |                  -- Elbert Hubbard


     +------------------------------------------------------------+
     | 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