MCPcopy Create free account
hub / github.com/NetHack/NetHack / ray_checkinput

Function ray_checkinput

sys/windows/consoletty.c:3567–3663  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3565}
3566
3567int
3568ray_checkinput(
3569 HANDLE hConIn,
3570 INPUT_RECORD *ir,
3571 DWORD *count,
3572 uchar numberpad,
3573 int mode,
3574 int *mod,
3575 coord *cc)
3576{
3577#if defined(SAFERHANGUP)
3578 DWORD dwWait;
3579#endif
3580 int ch = 0;
3581 boolean valid = 0, done = 0;
3582
3583#ifdef QWERTZ_SUPPORT
3584 if (numberpad & 0x10) {
3585 numberpad &= ~0x10;
3586 qwertz = TRUE;
3587 } else {
3588 qwertz = FALSE;
3589 }
3590#endif
3591 while (!done) {
3592 *count = 0;
3593 dwWait = WaitForSingleObject(hConIn, INFINITE);
3594#if defined(SAFERHANGUP)
3595 if (dwWait == WAIT_FAILED)
3596 return '\033';
3597#endif
3598 PeekConsoleInput(hConIn, ir, 1, count);
3599 if (mode == 0) {
3600 if ((ir->EventType == KEY_EVENT) && ir->Event.KeyEvent.bKeyDown) {
3601 ch = process_keystroke2(hConIn, ir, &valid);
3602 done = valid;
3603 } else
3604 ReadConsoleInput(hConIn, ir, 1, count);
3605 } else {
3606 ch = 0;
3607 if (*count > 0) {
3608 if (ir->EventType == KEY_EVENT
3609 && ir->Event.KeyEvent.bKeyDown) {
3610#ifdef QWERTZ_SUPPORT
3611 if (qwertz)
3612 numberpad |= 0x10;
3613#endif
3614 ch = ray_processkeystroke(hConIn, ir, &valid, numberpad,
3615#ifdef PORTDEBUG
3616 1);
3617#else
3618 0);
3619#endif
3620#ifdef QWERTZ_SUPPORT
3621 numberpad &= ~0x10;
3622#endif
3623 if (valid)
3624 return ch;

Callers

nothing calls this directly

Calls 2

process_keystroke2Function · 0.85
ray_processkeystrokeFunction · 0.85

Tested by

no test coverage detected