From f11bf73dd80b6cae14256d4700014400f1efa0eb Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Wed, 5 May 2010 17:13:18 +0000 Subject: [PATCH] Closing the terminal while watching a game did not update the # of watchers. git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@555 db0b04b0-f4d1-0310-9a6d-de3e77497b0e --- ttyplay.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/ttyplay.c b/ttyplay.c index 2361f29..010b851 100644 --- a/ttyplay.c +++ b/ttyplay.c @@ -192,14 +192,15 @@ int ttyread (FILE * fp, Header * h, char **buf, int pread) { long offset; - - if (kbhit()) - { - const int c = dgl_getch(); - const int action = ttyplay_keyboard_action(c); - if (action != READ_DATA) - return (action); - } + int kb = kbhit(); + + if (kb == ERR) return READ_QUIT; + else if (kb) { + const int c = dgl_getch(); + const int action = ttyplay_keyboard_action(c); + if (action != READ_DATA) + return (action); + } /* do this BEFORE header read, hlen bug */ offset = ftell (fp); -- 2.47.3