summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/stuff.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-07-28 07:19:25 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-07-28 07:19:25 +0000
commit7da9fbce1aed84ac9b02d8c4f7363ca02429d238 (patch)
treeccf8d14af5e134344cd477453866c2cd682e34db /crawl-ref/source/stuff.cc
parentf086209f1e223b89cb392fd71bdebe2f3551f1f7 (diff)
downloadcrawl-ref-7da9fbce1aed84ac9b02d8c4f7363ca02429d238.tar.gz
crawl-ref-7da9fbce1aed84ac9b02d8c4f7363ca02429d238.zip
Backport r10443: generalized way of dealing with "disconnect at --more--"
hacks. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup-0.5@10444 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/stuff.cc')
-rw-r--r--crawl-ref/source/stuff.cc18
1 files changed, 15 insertions, 3 deletions
diff --git a/crawl-ref/source/stuff.cc b/crawl-ref/source/stuff.cc
index 43bcdb7a77..da82087544 100644
--- a/crawl-ref/source/stuff.cc
+++ b/crawl-ref/source/stuff.cc
@@ -775,7 +775,7 @@ void end(int exit_code, bool print_error, const char *format, ...)
}
#if defined(WIN32CONSOLE) || defined(DOS) || defined(DGL_PAUSE_AFTER_ERROR)
- if (exit_code && !crawl_state.arena)
+ if (exit_code && !crawl_state.arena && !crawl_state.seen_hups)
{
fprintf(stderr, "Hit Enter to continue...\n");
getchar();
@@ -1065,12 +1065,21 @@ bool yesno( const char *str, bool safe, int safeanswer, bool clear_after,
int tmp = getchm(KMC_CONFIRM);
+#if defined(USE_UNIX_SIGNALS) && defined(SIGHUP_SAVE) && defined(USE_CURSES)
+ // Prevent infinite loop if Curses HUP signal handling happens;
+ // if there is no safe answer, then just save-and-exit immediately,
+ // since there's no way to know if it would be better to return
+ // true or false.
+ if (crawl_state.seen_hups && !safeanswer)
+ sighup_save_and_exit();
+#endif
+
if (map && map->find(tmp) != map->end())
tmp = map->find(tmp)->second;
if (safeanswer
&& (tmp == ' ' || tmp == ESCAPE || tmp == CONTROL('G')
- || tmp == '\r' || tmp == '\n'))
+ || tmp == '\r' || tmp == '\n' || crawl_state.seen_hups))
{
tmp = safeanswer;
}
@@ -1166,8 +1175,11 @@ int yesnoquit( const char* str, bool safe, int safeanswer, bool allow_all,
int tmp = getchm(KMC_CONFIRM);
- if (tmp == CK_ESCAPE || tmp == CONTROL('G') || tmp == 'q' || tmp == 'Q')
+ if (tmp == CK_ESCAPE || tmp == CONTROL('G') || tmp == 'q' || tmp == 'Q'
+ || crawl_state.seen_hups)
+ {
return -1;
+ }
if ((tmp == ' ' || tmp == '\r' || tmp == '\n') && safeanswer)
tmp = safeanswer;