]> skyeroc.xyz Git - dgamelaunch/commitdiff
Closing the terminal while watching a game did not update the # of watchers.
authorPasi Kallinen <paxed@alt.org>
Wed, 5 May 2010 17:13:18 +0000 (17:13 +0000)
committerPasi Kallinen <paxed@alt.org>
Wed, 5 May 2010 17:13:18 +0000 (17:13 +0000)
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@555 db0b04b0-f4d1-0310-9a6d-de3e77497b0e

ttyplay.c

index 2361f29e7827cced0422043b8f9612ab1b634a9c..010b8519269de74626cbf7658fac00a4c116312f 100644 (file)
--- 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);