Aw, code, it grows up so fast!
main() calls welcome();
welcome() calls openhelp();
If welcome() can't open the helpfile (I haven't copied the data files over yet), it calls drawscreen()
drawscreen() calls bot_linex()
bot_linex() calls lprintf(" Exp: %-9d %s\n",(long)c[EXPERIENCE],classname[c[LEVEL]-1]);
since c[LEVEL] = 0, that attempts to access classname[-1], which is invalid.
the bug is that drawscreen() shouldn't be calling bot_linex() at this point. There is a special flag (d_flag) that would have prevented it, but it isn't getting set in this corner case. It's possible that the variables used to detect if d_flag should be true are getting set are improperly getting set. I just added an extra flag to drawscreen in this case.
No comments:
Post a Comment