diff --git a/xtrn/sbj/sbj.c b/xtrn/sbj/sbj.c index 36966cac7176dd42b63cade4fc595cb7c5371778..c15ae6a999c5c433cf7a021a5ce50699ff2126fd 100644 --- a/xtrn/sbj/sbj.c +++ b/xtrn/sbj/sbj.c @@ -303,7 +303,7 @@ int main(int argc, char **argv) putchar(5); /* ctrl-e */ mswait(500); - if(kbhit()) { + if(keyhit()) { #ifdef __16BIT__ while(_bios_keybrd(1)) _bios_keybrd(0); @@ -580,7 +580,7 @@ while(1) { ,ibet<credits/1024L ? ibet : credits/1024L); chat(); mnemonics(str); - if(autoplay && kbhit()) + if(autoplay && keyhit()) autoplay=0; if(autoplay) i=ibet; @@ -783,7 +783,7 @@ while(1) { strcat(str,", or [Stand]: "); chat(); mnemonics(str); - if(autoplay && kbhit()) + if(autoplay && keyhit()) autoplay=0; diff --git a/xtrn/sdk/xsdk.c b/xtrn/sdk/xsdk.c index a5e22380d28d6c4c16362590db83797a0339c15f..ab1aa333edcc8c244d9340e344ab6097b18175c5 100644 --- a/xtrn/sdk/xsdk.c +++ b/xtrn/sdk/xsdk.c @@ -522,6 +522,18 @@ void mnemonics(char *str) attr(LIGHTGRAY); } +int keyhit() +{ +#ifndef __16BIT__ + int cnt=0; + if(ioctlsocket(client_socket,FIONREAD,&cnt)) + return(0); + return(cnt); +#else + return(kbhit()); +#endif +} + /****************************************************************************/ /* If a key has been pressed, the ASCII code is returned. If not, 0 is */ /* returned. Ctrl-P and Ctrl-U are intercepted here. */ diff --git a/xtrn/sdk/xsdk.h b/xtrn/sdk/xsdk.h index dbdf440b96aba9d3ca079e37a696dd97aeacc75d..7a62756812f0d0d59e704218f0a44c054c803443 100644 --- a/xtrn/sdk/xsdk.h +++ b/xtrn/sdk/xsdk.h @@ -44,10 +44,12 @@ /*********************************************/ #ifndef __unix__ #include <io.h> - #include <dos.h> #include <share.h> #include <conio.h> #endif +#ifdef __16BIT__ + #include <dos.h> +#endif #ifdef _WIN32 #include <windows.h> #endif @@ -145,6 +147,10 @@ char noyes(char *str); - Does not wait for a keystroke */ char inkey(long mode); +/* Key hit? + - Returns non-zero if key hit, 0 otherwise */ +int keyhit(void); + /* Get a Key - Waits for the local or remote user to hit a valid key - See K_* constants in XSDKDEFS.H for possible values of mode */