Skip to content

Commit 6e0e5ef

Browse files
committed
Adjust auto-recovery feedback.
Inspired by a very recent NetHack 3.7 update (git commit b37f140), I've adjusted the feedback when recovering a crashed game. Takes up much less space than previously. The NetHack devteam's solution for auto-recovery is more elegant than the one currently in place, but using it will need to wait until EvilHack is ported over to 3.7 codebase.
1 parent 9d1b386 commit 6e0e5ef

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

doc/evilhack-changelog.md

+1
Original file line numberDiff line numberDiff line change
@@ -3344,4 +3344,5 @@ The following changes to date are:
33443344
- Fix: allow spear traps to be disarmed
33453345
- Fix: heap-use-after-free (bones)
33463346
- Fix: follow up to crash when examining discoveries with '`' in certain cases
3347+
- Adjust auto-recovery feedback
33473348

sys/unix/unixunix.c

+7-6
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,15 @@ getlock()
167167
goto gotlock;
168168
(void) close(fd);
169169

170-
{
170+
/* drop the "perm" lock while the user decides */
171+
unlock_file(HLOCK);
171172
if (iflags.window_inited) {
172173
/* this is a candidate for paranoid_confirmation */
173-
c = yn_function("There is already a game in progress under your name. Recover it [r], Destroy old game [y], Cancel [n] ?", "ryn", 'n');
174+
c = yn_function("Old game in progress. Destroy [y], Recover [r], or Cancel [n]?", "ynr", 'n');
174175
} else {
175176
(void) printf("\nThere is already a game in progress under your name. Do what?\n");
176-
(void) printf("\n r - Try to recover it?");
177-
(void) printf("\n y - Destroy old game?");
177+
(void) printf("\n y - Destroy old game");
178+
(void) printf("\n r - Try to recover it");
178179
(void) printf("\n n - Cancel");
179180
(void) printf("\n\n => ");
180181
(void) fflush(stdout);
@@ -184,10 +185,10 @@ getlock()
184185
(void) printf("\033[7A"); /* cursor up 7 */
185186
(void) printf("\033[J"); /* clear from cursor down */
186187
}
187-
}
188+
188189
if (c == 'r' || c == 'R') {
189190
if (restore_savefile(lock, fqn_prefix[SAVEPREFIX]) == 0) {
190-
const char *msg = "Automatic recovery of save file successful! "
191+
const char *msg = "Automatic recovery of game successful! "
191192
"Press any key to continue...\n";
192193
fflush(stdout);
193194
if (iflags.window_inited) {

0 commit comments

Comments
 (0)