From: Pasi Kallinen Date: Wed, 5 May 2010 17:13:18 +0000 (+0000) Subject: Closing the terminal while watching a game did not update the # of watchers. X-Git-Tag: v1.6.1-roc-dev~155 X-Git-Url: https://skyeroc.xyz/gitweb/?a=commitdiff_plain;h=f11bf73dd80b6cae14256d4700014400f1efa0eb;p=dgamelaunch 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 --- 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);