X-Git-Url: https://jxself.org/git/?p=super-star-trek.git;a=blobdiff_plain;f=src%2Fio.c;h=fa028f52933078a621d985bbbac65c2fa3cea186;hp=c0867fbc9577d21717e02c094b6458d5d669e72a;hb=4d9c5a57b2a16c3c4bc54ab3f897f79101337eb5;hpb=18e74523dd6261a2672237611a06aa3bf5bf8a15 diff --git a/src/io.c b/src/io.c index c0867fb..fa028f5 100644 --- a/src/io.c +++ b/src/io.c @@ -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'); } @@ -212,12 +209,12 @@ void cgetline(char *line, int max) wrefresh(curwnd); } else { if (replayfp && !feof(replayfp)) - fgets(line, max, replayfp); + (void)fgets(line, max, replayfp); else - fgets(line, max, stdin); + (void)fgets(line, max, stdin); } if (logfp) - fputs(line, logfp); + (void)fputs(line, logfp); line[strlen(line)-1] = '\0'; } @@ -393,7 +390,7 @@ void warble(void) void tracktorpedo(coord w, int l, int i, int n, int iquad) /* torpedo-track animation */ { - if (!game.options & OPTION_CURSES) { + if (!(game.options & OPTION_CURSES)) { if (l == 1) { if (n != 1) { skip(1);