[Newbie][Code] Spells/Skills List Error

From: Abraham Dizon (soldier2003@hotmail.com)
Date: 06/20/01


A couple more errors I found after I found the who errors.

Compiler:
************

act.informative.c: In function 'do_skills':
act.informative.c:219: warning: unused variable 'spells'

Snippet:
***********

/* Put all of this into act.informative.c */
char *howgood(int percent)
{
  static char buf[256];

  if (percent == 0)
    strcpy(buf, " (not learned)");
  else if (percent <= 10)
    strcpy(buf, " (awful)");
  else if (percent <= 20)
    strcpy(buf, " (bad)");
  else if (percent <= 40)
    strcpy(buf, " (poor)");
  else if (percent <= 55)
    strcpy(buf, " (average)");
  else if (percent <= 70)
    strcpy(buf, " (fair)");
  else if (percent <= 80)
    strcpy(buf, " (good)");
  else if (percent <= 85)
    strcpy(buf, " (very good)");
  else
    strcpy(buf, " (superb)");

  return (buf);
}

ACMD(do_spells)
{
  extern struct spell_info_type spell_info[];
  int i;

  strcpy(buf, "You know of the following Spells:\r\n");
  strcpy(buf2, buf);

  for (i = 1; i < MAX_SPELLS+1; i++) {
    if (GET_LEVEL(ch) >= spell_info[i].min_level[(int) GET_CLASS(ch)]) {
      if (GET_SKILL(ch, i) > 0) {
        sprintf(buf, "%-20s %s\r\n", spell_info[i].name,
howgood(GET_SKILL(ch, i)));
        strcat(buf2, buf);
      }
    }
  }
  page_string(ch->desc, buf2, 1);
}

ACMD(do_skills)
{
  extern char *spells[];
  extern struct spell_info_type spell_info[];
  int i;

  strcpy(buf, "You know of the following Skills:\r\n");
  strcpy(buf2, buf);

  for (i = MAX_SPELLS +1; i < MAX_SKILLS+1; i++) {
    if (GET_LEVEL(ch) >= spell_info[i].min_level[(int) GET_CLASS(ch)]) {
      if (GET_SKILL(ch, i) > 0) {
        sprintf(buf, "%-20s %s\r\n", spell_info[i].name,
howgood(GET_SKILL(ch, i)));
        strcat(buf2, buf);
      }
    }
  }
  page_string(ch->desc, buf2, 1);
}

I probably have just the extern wrong but I'm not sure whats it supposed to
be. Thanks for your help. Any input is welcome.

-Hero

One for all and all for one.
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/05/01 PST