mirror of
https://github.com/sockspls/badfish
synced 2025-05-01 01:03:09 +00:00
Triviality in data_available()
No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
b3545737fa
commit
4fa0395eb8
1 changed files with 4 additions and 4 deletions
|
@ -228,19 +228,19 @@ int data_available()
|
||||||
int data_available()
|
int data_available()
|
||||||
{
|
{
|
||||||
static HANDLE inh = NULL;
|
static HANDLE inh = NULL;
|
||||||
static bool usePipe;
|
static bool usePipe = false;
|
||||||
INPUT_RECORD rec[256];
|
INPUT_RECORD rec[256];
|
||||||
DWORD dw, recCnt;
|
DWORD dw, recCnt;
|
||||||
|
|
||||||
if (!inh)
|
if (!inh)
|
||||||
{
|
{
|
||||||
inh = GetStdHandle(STD_INPUT_HANDLE);
|
inh = GetStdHandle(STD_INPUT_HANDLE);
|
||||||
usePipe = !GetConsoleMode(inh, &dw);
|
if (GetConsoleMode(inh, &dw))
|
||||||
if (!usePipe)
|
|
||||||
{
|
{
|
||||||
SetConsoleMode(inh, dw & ~(ENABLE_MOUSE_INPUT | ENABLE_WINDOW_INPUT));
|
SetConsoleMode(inh, dw & ~(ENABLE_MOUSE_INPUT | ENABLE_WINDOW_INPUT));
|
||||||
FlushConsoleInputBuffer(inh);
|
FlushConsoleInputBuffer(inh);
|
||||||
}
|
} else
|
||||||
|
usePipe = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we're running under XBoard then we can't use PeekConsoleInput() as
|
// If we're running under XBoard then we can't use PeekConsoleInput() as
|
||||||
|
|
Loading…
Add table
Reference in a new issue