[CODE] Skill/spell snippet

From: Christoffer Lundberg (avatar@ORION.BODEN.SE)
Date: 04/27/98


I've gotten the skill/spell snippet from Alex's site. It compiled fine,
but when I type "prac" the MUD crashes and I get informed of a "bus
error". This is how the code looks for me:

void list_skills(struct char_data *ch)
{
  extern char *spells[];
  extern struct spell_info_type spell_info[];
  int i;

  sprintf(buf, "You know of the following skills:\r\n---------------------------------\r\n");

  strcpy(buf2, buf);

  for (i = MAX_SPELLS ; i < MAX_SKILLS; i++) {
    if (strlen(buf2) >= MAX_STRING_LENGTH - 32) {
      strcat(buf2, "OVERFLOW in spec_procs.c\r\n");
      break;
    }
    if (GET_SKILL(ch, i)) {
      sprintf(buf, "%-20s %s", spells[i], how_good(GET_SKILL(ch, i)));
      strcat(buf2, buf);
    }
  }
  if (IS_INQUISITOR(ch) || IS_MYSTIC(ch)) {
  sprintf(buf, "\r\n\r\nAnd the following formulas:\r\n---------------------------\r\n");
  strcat(buf2, buf);

  for (i = 1; i < MAX_SPELLS; i++) {
    if (strlen(buf2) >= MAX_STRING_LENGTH - 32) {
      strcat(buf2, "*OVERFLOW in spec_procs.c\r\n");
      break;
    }
    if (GET_SKILL(ch, i)) {
      sprintf(buf, "%-20s %s", spells[i],
      how_good(GET_SKILL(ch, i)));
      strcat(buf2, buf);
    }
 }
}
  page_string(ch->desc, buf2, 1);
}


What can be causing this?

>Christoffer


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