CODE: Autodiag problem

From: Spencer Miles (mojoman@PACIFIER.COM)
Date: 04/17/98


Hello,
I finally figured out where my mud has been crashing. It is something
wrong with Diagnose or autodiagnose i think. When i debug it and it
crashes visual c++ 5.0 takes me to this function in act.informative.c


void diag_char_to_char(struct char_data * i, struct char_data * ch)
{
  int percent;

  if (GET_MAX_HIT(i) > 0)
    percent = (100 * GET_HIT(i)) / GET_MAX_HIT(i);
  else
    percent = -1;               /* How could MAX_HIT be < 1?? */

  strcpy(buf, PERS(i, ch));
  CAP(buf);

  if (percent >= 100)
    strcat(buf, " \x1B[0;36mis lookin pretty good.\x1B[0;0m\r\n");
  else if (percent >= 90)
    strcat(buf, " \x1B[0;36mis a bit smacked up.\x1B[0;0m\r\n");
  else if (percent >= 75)
    strcat(buf, " \x1B[0;33mis getting a tad bit bloody.\x1B[0;0m\r\n");
  else if (percent >= 50)
    strcat(buf, " \x1B[0;33mis having quite a bit of
trouble.\x1B[0;0m\r\n");
  else if (percent >= 30)
    strcat(buf, " \x1B[0;33mhas blood dripping from his
chin.\x1B[0;0m\r\n");
  else if (percent >= 15)
    strcat(buf, " \x1B[0;31mis bleeding all over the
place.\x1B[0;0m\r\n");
  else if (percent >= 0)
    strcat(buf, " \x1B[0;31mis begging mojo for
forgiveness.\x1B[0;0m\r\n");
  else
    strcat(buf, " \x1B[0;31mis tossing satan's salad.\x1B[0;0m\r\n");

  send_to_char(buf, ch);
}


Whenver i am fighting something, and it gets down around 0 percent it
crashes. I haven't been able to figure out why, and i was hoping that
one of you could shed some lite on the situation. The code that does
autodiag is right here.
In fight.c
    if (PRF_FLAGGED(ch, PRF_AUTODIAG) && !IS_NPC(ch))
       diag_char_to_char(FIGHTING(ch), ch);
This is down towards the bottom of the file after the line:
    hit(ch, FIGHTING(ch), TYPE_UNDEFINED);


Thanks,
Spencer


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