NEWBIE: messing with the CON_xxxx states in interpreter.c

zero@baker.cnw.com
Date: 05/20/96


Ive added some code to my nanny function and I cant figure out why there 
is a problem. Originally i added this, basically a copy of the stock 
CON_QCLASS and parse_race is also a copy of parse_class with changes 
returns and letters. the following code works fine:

  case CON_QRACE:
    load_result = parse_race(*arg);
    if (load_result == RACE_UNDEFINED) {
      SEND_TO_Q("\r\nThat's not a valid choice.\r\nRace: ", d);
      return;
    } else
       GET_RACE(d->character) = load_result;

The problem is when a race is chosen I want it to show a small help file 
and then make sure the player still wants to choose that race.  If the 
answer is no it will return and ask the character to choose another race 
etc untill the character says yes. I tried to add the below code using 
the below race_help_menu but as soon as the character tries to choose a 
race the entire mud freezes up.

  case CON_QRACE:
    load_result = parse_race(*arg);
    if (load_result == RACE_UNDEFINED) {
      SEND_TO_Q("\r\nThat's not a valid choice.\r\nRace: ", d);
      return;
    } else
      SEND_TO_Q(race_help_menu[load_result], d);
      SEND_TO_Q("\r\nAre you sure you want to choose this race? (yes/no) 
[yes]  ", d);
      gets(ans);
      if(!str_cmp(ans, "no")) {
         SEND_TO_Q(race_menu, d);
         SEND_TO_Q("\r\nRace: ", d);
         return;
      } else {
         GET_RACE(d->character) = load_result;
      }

const char *race_help_menu[] = {
  "\r\nHuman",
  "\r\nElf",
  "\r\nGnome",
  "\r\nDwarf",
  "\r\nHalf-Elf",
  "\r\nGiant-Kin",
  "\r\nDragon-Kin",
  "\r\nFaerie-Kin",               /* for testing purposes */
  "\r\nHalf-Orc",
  "\r\nKobold",         
  "\r\nMinotaur",
  "\r\nNorthlander",
  "\r\nDrow Elf",
  "\r\nGrey Elf",
  "\r\nSylvan Elf",
  "\r\nSorathian",
  "\n"
};


Can some please tell me what is wrong with this code?

Thanks,
Chris



This archive was generated by hypermail 2b30 : 12/18/00 PST