Mercurial > hg > early-roguelike
comparison arogue5/options.c @ 145:aac28331e71d
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.
| author | John "Elwin" Edwards |
|---|---|
| date | Wed, 20 May 2015 08:42:17 -0400 |
| parents | d4bf99f82ea0 |
| children | 56e748983fa8 |
comparison
equal
deleted
inserted
replaced
| 144:708bb2dea17c | 145:aac28331e71d |
|---|---|
| 38 int put_bool(), | 38 int put_bool(), |
| 39 get_bool(), | 39 get_bool(), |
| 40 put_str(), | 40 put_str(), |
| 41 get_str(), | 41 get_str(), |
| 42 get_restr(), | 42 get_restr(), |
| 43 get_score(), | |
| 43 put_abil(), | 44 put_abil(), |
| 44 get_abil(), | 45 get_abil(), |
| 45 get_quest(), | 46 get_quest(), |
| 46 put_quest(); | 47 put_quest(); |
| 47 | 48 |
| 63 {"fruit", "Fruit: ", | 64 {"fruit", "Fruit: ", |
| 64 (int *) fruit, put_str, get_str }, | 65 (int *) fruit, put_str, get_str }, |
| 65 {"file", "Save file: ", | 66 {"file", "Save file: ", |
| 66 (int *) file_name, put_str, get_restr }, | 67 (int *) file_name, put_str, get_restr }, |
| 67 {"score", "Score file: ", | 68 {"score", "Score file: ", |
| 68 (int *) score_file, put_str, get_restr }, | 69 (int *) score_file, put_str, get_score }, |
| 69 {"class", "Character class: ", | 70 {"class", "Character class: ", |
| 70 (int *)&char_type, put_abil, get_abil }, | 71 (int *)&char_type, put_abil, get_abil }, |
| 71 {"quest", "Quest item: ", | 72 {"quest", "Quest item: ", |
| 72 (int *) &quest_item, put_quest, get_quest } | 73 (int *) &quest_item, put_quest, get_quest } |
| 73 }; | 74 }; |
| 83 put_str(optstr, win); | 84 put_str(optstr, win); |
| 84 return get_ro(win, oy, ox); | 85 return get_ro(win, oy, ox); |
| 85 } | 86 } |
| 86 else | 87 else |
| 87 return get_str(optstr, win); | 88 return get_str(optstr, win); |
| 89 } | |
| 90 | |
| 91 /* For the score file, which must be opened. */ | |
| 92 int get_score(char *optstr, WINDOW *win) | |
| 93 { | |
| 94 char old_score_file[LINELEN]; | |
| 95 int status; | |
| 96 | |
| 97 if (use_savedir) | |
| 98 return get_restr(optstr, win); | |
| 99 | |
| 100 strcpy(old_score_file, optstr); | |
| 101 status = get_str(optstr, win); | |
| 102 if (status != NORM) | |
| 103 return status; | |
| 104 if (strcmp(old_score_file, optstr)) | |
| 105 { | |
| 106 md_reopen_score(); | |
| 107 } | |
| 108 return status; | |
| 88 } | 109 } |
| 89 | 110 |
| 90 /* | 111 /* |
| 91 * The ability field is read-only | 112 * The ability field is read-only |
| 92 */ | 113 */ |
