Pull SERGEEV dependencies out of reports.c.
authorEric S. Raymond <esr@thyrsus.com>
Thu, 3 Feb 2005 22:50:15 +0000 (22:50 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 3 Feb 2005 22:50:15 +0000 (22:50 +0000)
conio.c
io.c
reports.c

diff --git a/conio.c b/conio.c
index d603349ad0934eb705ad4da2245c8fd5105bb520..95e8a78c81085bdd1f1aa5483e352c719915e0a6 100644 (file)
--- a/conio.c
+++ b/conio.c
@@ -124,9 +124,12 @@ char *cgets (char *str) /* ugly function :-( */
 }
 
 void clreol (void)
+/* clear to end of line -- can be a no-op in tty mode */
 {
+#ifdef SERGEEV
    wclrtoeol(conio_scr);
    wrefresh(conio_scr);
+#endif /* SERGEEV */
 }
 
 void clrscr (void)
@@ -215,17 +218,22 @@ void gettextinfo(struct text_info *inforec)
 } 
 
 void gotoxy (int x, int y)
+/* address cusor -- OK for this to be a no-op in TTY mode */
 {
+#ifdef SERGEEV
    y--;
    x--;
    wmove(conio_scr,y,x);
    wrefresh(conio_scr);
+#endif /* SERGEEV */
 }
 
 void highvideo (void)
 {
+#ifdef SERGEEV
    textcolor(15); /* White */
    textbackground(0); /* Black */
+#endif /* SERGEEV */
 }
 
 void insline (void)
diff --git a/io.c b/io.c
index 309069318356ed571d6bd5f7c8f31280b9ba6590..bce39c2c8c7f010ac06c73f3b6fd987ca6b6316c 100644 (file)
--- a/io.c
+++ b/io.c
@@ -277,6 +277,20 @@ void prouts(char *fmt, ...) {
 #endif /* SERGEEV */
 }
 
+void c_printf (char *format, ... )
+{
+    char buffer[BUFSIZ]; /* Well, BUFSIZ is from ncurses...  */
+    va_list argp;
+    va_start(argp,format);
+    vsprintf(buffer,format,argp);
+    va_end(argp);
+#ifdef SERGEEV
+    waddstr(conio_scr,buffer);
+#else
+    proutn(buffer);
+#endif /* SERGEEV */
+}
+
 void warble(void)
 /* sound and visual effects for teleportation */
 {
index 32ee650d8b71c90623e5eadf9c9567b41b711d51..cf5da97de435434397d02a4f7112bff4d6393eb0 100644 (file)
--- a/reports.c
+++ b/reports.c
@@ -5,20 +5,6 @@
 #include "conio.h"
 #include "sstlinux.h"
 
-#ifdef SERGEEV
-int c_printf (char *format, ... )
-{
-    char buffer[BUFSIZ]; /* Well, BUFSIZ is from ncurses...  */
-    va_list argp;
-    va_start(argp,format);
-    vsprintf(buffer,format,argp);
-    va_end(argp);
-    return waddstr(conio_scr,buffer);
-}
-#else
-#define c_printf proutn
-#endif /* SERGEEV */
-
 void attakreport(int l) {
      if (!l) {
        if (game.future[FCDBAS] < 1e30) {
@@ -39,9 +25,7 @@ void attakreport(int l) {
         if (isatb == 1)
            proutn("Base in %i - %i attacked by S. Alive until %.1f", game.state.isx, game.state.isy, game.future[FSCDBAS]);
      }
-#ifdef SERGEEV
      clreol();
-#endif /* SERGEEV */
 }
        
 
@@ -213,9 +197,7 @@ void chart(int nn) {
                                 strcpy(buf, "...");
                        else if (game.starch[i][j] > 999)
                                 if ((i==quadx)&&(j==quady)){
-#ifdef SERGEEV
                                    gotoxy(wherex()-1,wherey());
-#endif /* SERGEEV */
                                    if (game.starch[i][i]<2000)
                                       sprintf(buf, "%03d", game.starch[i][j]-1000);
                                    else 
@@ -227,9 +209,7 @@ void chart(int nn) {
                                     else 
                                        strcpy(buf, "***");
                         else if ((i==quadx)&&(j==quady)){
-#ifdef SERGEEV
                                 gotoxy(wherex()-1,wherey());
-#endif /* SERGEEV */
                                 sprintf(buf, "%03d", game.state.galaxy[i][j]);
                         }
                         else if (game.state.galaxy[i][j]>=1000)
@@ -244,11 +224,7 @@ void chart(int nn) {
                 c_printf("  |");
                 if (i<8) c_printf("\n\r");
        }
-#ifdef SERGEEV
-       proutn("");     /* flush output */
-#else
-       skip(2);
-#endif
+       prout("");      /* flush output */
 }
                
                
@@ -298,13 +274,9 @@ int srscan(int l) {
                                                 case IHDOCKED: textcolor(LIGHTGRAY); break;
                                                 case IHDEAD: textcolor(WHITE);
                                         }
-#ifdef SERGEEV
                                         if (game.quad[i][j]!=ship) highvideo();
-#endif /* SERGEEV */
                                    }
-#ifdef SERGEEV
                                    if (game.quad[i][j] & 128) highvideo();
-#endif /* SERGEEV */
                                    c_printf("%c ",game.quad[i][j] & 127);
                                    textcolor(LIGHTGRAY);
                                 }
@@ -377,11 +349,7 @@ int srscan(int l) {
                if (k!=0) return(goodScan);
        }
        if (nn) chart(1);
-#ifdef SERGEEV
-       proutn("");
-#else
-       skip(2);
-#endif /* SERGEEV */
+       prout("");
         return(goodScan);
 }