| 3084 | } |
| 3085 | |
| 3086 | int |
| 3087 | default_checkinput( |
| 3088 | HANDLE hConIn, |
| 3089 | INPUT_RECORD *ir, |
| 3090 | DWORD *count, |
| 3091 | uchar numberpad, |
| 3092 | int mode, |
| 3093 | int *mod, |
| 3094 | coord *cc) |
| 3095 | { |
| 3096 | #if defined(SAFERHANGUP) |
| 3097 | DWORD dwWait; |
| 3098 | #endif |
| 3099 | int ch = 0; |
| 3100 | boolean valid = 0, done = 0, done_a_checkpoint = FALSE; |
| 3101 | DWORD how_many_milliseconds = 0; |
| 3102 | |
| 3103 | #ifdef QWERTZ_SUPPORT |
| 3104 | if (numberpad & 0x10) { |
| 3105 | numberpad &= ~0x10; |
| 3106 | qwertz = TRUE; |
| 3107 | } else { |
| 3108 | qwertz = FALSE; |
| 3109 | } |
| 3110 | #endif |
| 3111 | done_a_checkpoint = FALSE; |
| 3112 | how_many_milliseconds = (iflags.idlecheckpoint) |
| 3113 | ? (IDLECHECKPOINT_WAIT_TIME * 1000) |
| 3114 | : INFINITE; |
| 3115 | while (!done) { |
| 3116 | dwWait = WaitForSingleObjectEx(hConIn, // event object to wait for |
| 3117 | how_many_milliseconds, |
| 3118 | TRUE); // alertable wait enabled |
| 3119 | #if defined(SAFERHANGUP) |
| 3120 | if (dwWait == WAIT_FAILED) |
| 3121 | return '\033'; |
| 3122 | #endif |
| 3123 | if (iflags.idlecheckpoint |
| 3124 | && dwWait == WAIT_TIMEOUT && !done_a_checkpoint) { |
| 3125 | /* no input for 30 seconds, so let's take |
| 3126 | * advantage and do a game checkpoint, |
| 3127 | * then resume the wait. |
| 3128 | */ |
| 3129 | #ifdef INSURANCE |
| 3130 | save_currentstate(); |
| 3131 | #endif /* INSURANCE */ |
| 3132 | done_a_checkpoint = TRUE; |
| 3133 | } else |
| 3134 | { |
| 3135 | ReadConsoleInput(hConIn, ir, 1, count); |
| 3136 | if (mode == 0) { |
| 3137 | if ((ir->EventType == KEY_EVENT) |
| 3138 | && ir->Event.KeyEvent.bKeyDown) { |
| 3139 | ch = default_processkeystroke(hConIn, ir, &valid, |
| 3140 | numberpad, 0); |
| 3141 | done = valid; |
| 3142 | } |
| 3143 | } else { |
nothing calls this directly
no test coverage detected