From: Eric S. Raymond Date: Thu, 3 Feb 2005 20:00:17 +0000 (+0000) Subject: Partial merge of I/O management. X-Git-Tag: 2.0~403 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=5fd1629b862b1a1bba3f70d4d06ba0b0859ec0e6;p=super-star-trek.git Partial merge of I/O management. --- diff --git a/io.c b/io.c index f4ed854..3bc3b9c 100644 --- a/io.c +++ b/io.c @@ -101,10 +101,10 @@ void clearscreen(void) { } void pause_game(int i) { + char *prompt; #ifndef SERGEEV - char buf[BUFSIZ], *prompt; + char buf[BUFSIZ]; #else /* SERGEEV */ - char *prompt; drawmaps(0); setwnd(5); #endif /* SERGEEV */ @@ -287,6 +287,7 @@ void prouts(char *fmt, ...) { } void warble(void) +/* sound and visual effects for teleportation */ { #ifdef SERGEEV int posx, posy; diff --git a/moving.c b/moving.c index 4f2af10..537a82b 100644 --- a/moving.c +++ b/moving.c @@ -209,9 +209,7 @@ label100: } newcnd(); iattak = 0; -#ifdef SERGEEV drawmaps(0); -#endif /* SERGEEV */ return; } diff --git a/planets.c b/planets.c index 01e14b7..5ed87df 100644 --- a/planets.c +++ b/planets.c @@ -82,10 +82,7 @@ void orbit(void) { } void sensor(void) { -#ifdef SERGEEV - if (game.damage[DSRSENS] != 0.0) return; - if ((plnetx != 0)&&(game.state.plnets[iplnet].known == 0)) { -#else +#ifndef SERGEEV skip(1); chew(); if (game.damage[DSRSENS] != 0.0) { @@ -96,7 +93,9 @@ void sensor(void) { prout("No planet in this quadrant."); return; } -#endif /* SERGEEV */ +#else + if (game.damage[DSRSENS] != 0.0) return; + if ((plnetx != 0)&&(game.state.plnets[iplnet].known == 0)) { prout("Spock- \"Sensor scan for %s-", cramlc(quadrant, quadx, quady)); skip(1); prout(" Planet at %s is of class %s.", @@ -108,7 +107,6 @@ void sensor(void) { if (game.state.plnets[iplnet].crystals == 0) proutn(" no"); prout(" dilithium crystals present.\""); if (game.state.plnets[iplnet].known == unknown) game.state.plnets[iplnet].known = known; -#ifdef SERGEEV } #endif /* SERGEEV */ } diff --git a/sst.c b/sst.c index 409b489..346bb4c 100644 --- a/sst.c +++ b/sst.c @@ -261,8 +261,9 @@ static void helpme(void) { fclose(fp); } +void drawmaps(short l) { +/* hook to be called after moving to redraw maps */ #ifdef SERGEEV -void drawmaps(short l){ _setcursortype(_NOCURSOR); if (l==1) sensor(); if (l!=2) setwnd(1); @@ -279,8 +280,8 @@ void drawmaps(short l){ lrscan(); _setcursortype(_NORMALCURSOR); } -} #endif /* SERGEEV */ +} static void makemoves(void) { int i, hitme; @@ -289,9 +290,7 @@ static void makemoves(void) { setwnd(4); #endif /* SERGEEV */ while (TRUE) { /* command loop */ -#ifdef SERGEEV drawmaps(1); -#endif /* SERGEEV */ while (TRUE) { /* get a command */ hitme = FALSE; justin = 0; diff --git a/sst.h b/sst.h index da406c1..9c964fa 100644 --- a/sst.h +++ b/sst.h @@ -423,9 +423,7 @@ int isit(char *); void preport(void); void orbit(void); void sensor(void); -#ifdef SERGEEV void drawmaps(short); -#endif /* SERGEEV */ void beam(void); void mine(void); void usecrystals(void); @@ -438,16 +436,12 @@ void probe(void); void clearscreen(void); void iostart(int); void ioend(void); -#ifdef SERGEEV void setwnd(short); -#endif /* SERGEEV */ void warble(void); void getline(char *, int); void commandhook(char *, int); -#ifdef SERGEEV typedef struct { int wndleft,wndtop,wndright,wndbottom; } wnd; extern wnd wnds[6]; -#endif /* SERGEEV */ diff --git a/sstlinux.c b/sstlinux.c index b376b39..316d58a 100644 --- a/sstlinux.c +++ b/sstlinux.c @@ -10,6 +10,7 @@ static int fd = 0; +#ifdef SERGEEV int c_printf (char *format, ... ) { char buffer[BUFSIZ]; /* Well, BUFSIZ is from ncurses... */ @@ -19,6 +20,7 @@ int c_printf (char *format, ... ) va_end(argp); return waddstr(conio_scr,buffer); } +#endif /* SERGEEV */ void sound(unsigned int freq) { diff --git a/sstlinux.h b/sstlinux.h index e4d4ea3..779f8eb 100644 --- a/sstlinux.h +++ b/sstlinux.h @@ -5,9 +5,7 @@ int c_printf (char *format, ... ); void sound(unsigned int); void nosound(void); -#ifdef SERGEEV extern WINDOW *conio_scr; -#endif /* SERGEEV */ #define delay(x) usleep(x*1000) #define randomize() srand((unsigned)time(NULL))