Advanced Rogue family: fix the "score" option.

Changing the score file (when permitted) now works again, closing the
old score file and opening the new one.
This commit is contained in:
John "Elwin" Edwards 2015-05-20 08:42:17 -04:00
parent ea4244de91
commit e3620a3781
14 changed files with 105 additions and 14 deletions

View file

@ -50,6 +50,7 @@ int put_bool(),
put_quest();
int get_str_prot(char *opt, WINDOW *win);
int get_score(char *opt, WINDOW *win);
bool allowchange(OPTION *op);
OPTION optlist[] = {
@ -72,7 +73,7 @@ OPTION optlist[] = {
{"file", "Save file: ",
(int *) file_name, put_str, get_str_prot },
{"score", "Score file: ",
(int *) score_file, put_str, get_str_prot },
(int *) score_file, put_str, get_score },
{"class", "Character class: ",
(int *)&char_type, put_abil, get_abil },
{"quest", "Quest item: ",
@ -486,6 +487,25 @@ get_str_prot(char *opt, WINDOW *win)
}
}
/* When getting the scorefile, the new file must be opened. */
int
get_score(char *optstr, WINDOW *win)
{
char old_score_file[LINELEN];
int status;
if (use_savedir)
return get_str_prot(optstr, win);
strcpy(old_score_file, optstr);
status = get_str(optstr, win);
if (status == NORM && strcmp(old_score_file, optstr))
{
md_reopen_score();
}
return status;
}
bool
allowchange(OPTION *op)
{