Imprive documentation, fix a typo, add the hacking guide.
[super-star-trek.git] / src / io.c
index 65edfdf59d07c2c0721eacba9a91f564f49a0046..416649f9d6b2f667e39d99e233fe5babb544a53a 100644 (file)
--- a/src/io.c
+++ b/src/io.c
@@ -72,7 +72,7 @@ void iostart(void)
        srscan_window     = newwin(12, 25, 0,       0);
        report_window     = newwin(11, 0,  1,       25);
        status_window     = newwin(10, 0,  1,       39);
-       lrscan_window     = newwin(10, 0,  0,       64); 
+       lrscan_window     = newwin(5,  0,  0,       64); 
        message_window    = newwin(0,  0,  12,      0);
        prompt_window     = newwin(1,  0,  LINES-2, 0); 
        scrollok(message_window, TRUE);
@@ -86,46 +86,43 @@ void waitfor(void)
 /* wait for user action -- OK to do nothing if on a TTY */
 {
     if (game.options & OPTION_CURSES)
-       getch();
+       wgetch(prompt_window);
 }
 
-void pause_game(bool announcement) 
+void announce(void)
 {
-    char *prompt;
-    char buf[BUFSIZ];
-    if (announcement) {
-       if (game.skill > SKILL_FAIR)
-           prompt = _("[ANOUNCEMENT ARRIVING...]");
-       else
-           prompt = _("[IMPORTANT ANNOUNCEMENT ARRIVING -- PRESS ENTER TO CONTINUE]");
-    }
-    else {
-       if (game.skill > SKILL_FAIR)
+    skip(1);
+    prouts(_("[ANNOUNCEMENT ARRIVING...]"));
+    skip(1);
+}
+
+static void pause_game(void)
+{
+       char *prompt;
+       char buf[BUFSIZ];
+        if (game.skill > SKILL_FAIR)
            prompt = _("[CONTINUE?]");
        else
            prompt = _("[PRESS ENTER TO CONTINUE]");
 
-    }
-    if (game.options & OPTION_CURSES) {
-       drawmaps(0);
-       setwnd(prompt_window);
-       wclear(prompt_window);
-       waddstr(prompt_window, prompt);
-       wgetnstr(prompt_window, buf, sizeof(buf));
-       wclear(prompt_window);
-       wrefresh(prompt_window);
-       setwnd(message_window);
-    } else {
-       putchar('\n');
-       proutn(prompt);
-       fgets(buf, sizeof(buf), stdin);
-       if (announcement) {
+       if (game.options & OPTION_CURSES) {
+           drawmaps(0);
+           setwnd(prompt_window);
+           wclear(prompt_window);
+           waddstr(prompt_window, prompt);
+           wgetnstr(prompt_window, buf, sizeof(buf));
+           wclear(prompt_window);
+           wrefresh(prompt_window);
+           setwnd(message_window);
+       } else {
            int j;
+           putchar('\n');
+           proutn(prompt);
+           fgets(buf, sizeof(buf), stdin);
            for (j = 0; j < rows; j++)
                putchar('\n');
+           linecount = 0;
        }
-       linecount = 0;
-    }
 }
 
 
@@ -134,7 +131,7 @@ void skip(int i)
     while (i-- > 0) {
        if (game.options & OPTION_CURSES) {
            if (curwnd == message_window && getcury(curwnd) >= getmaxy(curwnd) - 3) {
-               pause_game(false);
+               pause_game();
                clrscr();
            } else {
                proutn("\n");
@@ -142,7 +139,7 @@ void skip(int i)
        } else {
            linecount++;
            if (linecount >= rows)
-               pause_game(false);
+               pause_game();
            else
                putchar('\n');
        }