projects
/
super-star-trek.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Simplify the starchart code.
[super-star-trek.git]
/
conio.c
diff --git
a/conio.c
b/conio.c
index 1aca05ebe0b2cb2bd9bf553e20b911a19cd01161..32cbb8c559b36b0f967cb4e46b1407aeba344e62 100644
(file)
--- a/
conio.c
+++ b/
conio.c
@@
-31,7
+31,6
@@
char color_warning=1;
int directvideo;
WINDOW *conio_scr;
int directvideo;
WINDOW *conio_scr;
-#ifdef SERGEEV
/* Some internals... */
static int colortab(int a) /* convert LINUX Color code to DOS-standard */
{
/* Some internals... */
static int colortab(int a) /* convert LINUX Color code to DOS-standard */
{
@@
-47,7
+46,6
@@
static int colortab(int a) /* convert LINUX Color code to DOS-standard */
}
return COLOR_BLACK;
}
}
return COLOR_BLACK;
}
-#endif /* SERGEEV */
static void docolor (int color) /* Set DOS-like text mode colors */
{
static void docolor (int color) /* Set DOS-like text mode colors */
{
@@
-61,9
+59,8
@@
static void docolor (int color) /* Set DOS-like text mode colors */
wattron(conio_scr,COLOR_PAIR(1+(color&7)+((color&112)>>1)));
}
wattron(conio_scr,COLOR_PAIR(1+(color&7)+((color&112)>>1)));
}
-#ifdef SERGEEV
/* Call this before any call to linux conio - except the port functions ! */
/* Call this before any call to linux conio - except the port functions ! */
-void
__attribute__((constructor)) initconio (void) /* This is needed, because ncurses needs to be initialized */
+void
initconio (void)
{
int x,y;
short pair;
{
int x,y;
short pair;
@@
-93,7
+90,6
@@
void __attribute__((constructor)) initconio (void) /* This is needed, because nc
textcolor(7);
textbackground(0);
}
textcolor(7);
textbackground(0);
}
-#endif /* SERGEEV */
/* Call this on exiting your program */
void doneconio (void)
/* Call this on exiting your program */
void doneconio (void)
@@
-126,20
+122,20
@@
char *cgets (char *str) /* ugly function :-( */
void clreol (void)
/* clear to end of line -- can be a no-op in tty mode */
{
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 */
+ if (conio_scr) {
+
wclrtoeol(conio_scr);
+
wrefresh(conio_scr);
+ }
}
void clrscr (void)
/* clear screen -- can be a no-op in tty mode */
{
}
void clrscr (void)
/* clear screen -- can be a no-op in tty mode */
{
-#ifdef SERGEEV
- wclear(conio_scr);
- wmove(conio_scr,0,0);
- wrefresh(conio_scr);
-#endif /* SERGEEV */
+ if (conio_scr) {
+
wclear(conio_scr);
+
wmove(conio_scr,0,0);
+
wrefresh(conio_scr);
+ }
}
int cprintf (char *format, ... )
}
int cprintf (char *format, ... )
@@
-151,12
+147,11
@@
int cprintf (char *format, ... )
vsprintf(buffer,format,argp);
va_end(argp);
vsprintf(buffer,format,argp);
va_end(argp);
-#ifdef SERGEEV
- i=waddstr(conio_scr,buffer);
- wrefresh(conio_scr);
-#else
- i=printf(buffer);
-#endif /* SERGEEV */
+ if (conio_scr) {
+ i=waddstr(conio_scr,buffer);
+ wrefresh(conio_scr);
+ } else
+ i=printf(buffer);
return(i);
}
return(i);
}
@@
-226,22
+221,22
@@
void gettextinfo(struct text_info *inforec)
}
void gotoxy (int x, int y)
}
void gotoxy (int x, int y)
-/* address cusor -- OK for this to be a no-op in TTY mode */
+/* address cu
r
sor -- 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 */
+ if (conio_scr) {
+
y--;
+
x--;
+
wmove(conio_scr,y,x);
+
wrefresh(conio_scr);
+ }
}
void highvideo (void)
{
}
void highvideo (void)
{
-#ifdef SERGEEV
- textcolor(15); /* White */
- textbackground(0); /* Black */
-#endif /* SERGEEV */
+ if (conio_scr) {
+
textcolor(15); /* White */
+
textbackground(0); /* Black */
+ }
}
void insline (void)
}
void insline (void)
@@
-295,11
+290,11
@@
void textbackground (int color)
void textcolor (int color)
{
void textcolor (int color)
{
-#ifdef SERGEEV
- fgc=color;
- color=(bgc*16)+fgc;
- docolor(color);
-#endif /* SERGEEV */
+ if (conio_scr) {
+
fgc=color;
+
color=(bgc*16)+fgc;
+
docolor(color);
+ }
}
void textmode (int mode)
}
void textmode (int mode)
@@
-309,20
+304,26
@@
void textmode (int mode)
int wherex (void)
{
int wherex (void)
{
- int y;
- int x;
- getyx(conio_scr,y,x);
- x++;
- return(x);
+ if (conio_scr) {
+ int y;
+ int x;
+ getyx(conio_scr,y,x);
+ x++;
+ return(x);
+ }
+ return (0);
}
int wherey (void)
{
}
int wherey (void)
{
- int y;
- int x;
- getyx(conio_scr,y,x);
- y++;
- return(y);
+ if (conio_scr) {
+ int y;
+ int x;
+ getyx(conio_scr,y,x);
+ y++;
+ return(y);
+ }
+ return (0);
}
void window (int left,int top,int right,int bottom)
}
void window (int left,int top,int right,int bottom)