Re: Spoken Language Code

From: Mark Garringer (zizazat@HOTMAIL.COM)
Date: 10/20/02


Ok, so I still seem to have some problems with my spoken language code. Any
time you try to pass an invalid language type, it chokes is_abbrev and core
dumps.

ACMD(do_languages)
{
  int i, found = FALSE;
  char arg[MAX_INPUT_LENGTH];

  one_argument(argument, arg);

  if (!*arg) {
    list_languages(ch);
    return;
  } else {
    for (i = MIN_LANGUAGES; i < MAX_SKILLS; i++) {
      if (is_abbrev(arg, languages[i-MIN_LANGUAGES]) && GET_SKILL(ch,i) >
60) {
        SPEAKING(ch) = i;
        send_to_char(ch, "You now speak %s.\r\n", languages[i-
MIN_LANGUAGES]);
        found = TRUE;
        break;
      }
    }
  }
  if (!found) {
    send_to_char(ch, "You do not know of any such language.\r\n");
    return;
  }
}


From gdb:

#0  is_abbrev (arg1=0xbffff01c "pizza", arg2=0x67 <Address 0x67 out of
bounds>)
    at interpreter.c:1159
#1  0x08049b1e in do_languages (ch=0x8176658, argument=0xbffff311 " pizza",
    cmd=262, subcmd=0) at act.comm.c:94
#2  0x0808af98 in command_interpreter (ch=0x8176658,
    argument=0xbffff30c "speak pizza") at interpreter.c:756

Obviously, pizza  is not a valid spoken language.

Am I miss using is_abbrev, or should I be trying to use something else like
search_block? Any guideance here would be most appreaciated!

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT