Good morning everyone, I am at the end of my rope on this one...I am trying to limit classes available by race during creation. Which is working very buggily. If a player chooses dwarf as race and then selects Ranger as class...it advises the player to "Please make a different selection" most of the time. Sometimes however it will crash the mud. Especially if you repeatedly choose Ranger over and over. It has varying levels of stability. Sometimes it will crash the first time you choose the invalid class...and sometimes you can choose the invalid class 12 times or so before it crashes. Here is my latest code attempt. from class.c: int parse_class(char arg, struct descriptor_data * d) { arg = LOWER(arg); switch (arg) { case 'a': return CLASS_WARRIOR; case 'b': if(IS_DWARF(d->character)) { /* **This is the line that is crashing my mud ** */ return CLASS_UNDEFINED;} else { return CLASS_RANGER; } break; case 'c': return CLASS_PALADIN; from nanny in interpreter.c case CON_QRACE: load_result = parse_race(*arg); if (load_result == RACE_UNDEFINED) { SEND_TO_Q("\r\nThat's not a race.\r\nRace: ", d); return; } else GET_RACE(d->character) = load_result; init_char(d->character); /* --relistan for statedit -- Some code moved into CON_QSTATS See below for details */ if (!d->olc) CREATE(d->olc, struct oasis_olc_data, 1); STATE(d) = CON_QSTATS; init_stats(d); break; /* --relistan 2/22/99 for configurable stats */ case CON_QSTATS: if (parse_stats(d, arg)) { if(d->olc) free(d->olc); save_char(d->character, NOWHERE); SEND_TO_Q(class_menu, d); SEND_TO_Q("\r\nClass: ", d); STATE(d) = CON_QCLASS; } break; case CON_QCLASS: load_result = parse_class(*arg); if (load_result == CLASS_UNDEFINED) { SEND_TO_Q("\r\nPlease make a different selection.\r\nClass: ", d); return; } else GET_CLASS(d->character) = load_result; if (GET_PFILEPOS(d->character) < 0) GET_PFILEPOS(d->character) = create_entry(GET_PC_NAME(d->character)); /* Now GET_NAME() will work properly. */ save_char(d->character, NOWHERE); save_player_index(); SEND_TO_Q(motd, d); SEND_TO_Q("\r\n\n*** PRESS RETURN: ", d); STATE(d) = CON_RMOTD; sprintf(buf, "%s [%s] new player.", GET_NAME(d->character), d->host); mudlog(buf, NRM, LVL_IMMORT, TRUE); break; -- +---------------------------------------------------------------+ | 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/04/01 PST