--cut here--cut here--cut here--cut here--cut here--cut here--cut here--
*** nethack-3.4.3/sys/winnt/nhraykey.c.old Sat Feb 14 18:39:20 2004
--- nethack-3.4.3/sys/winnt/nhraykey.c Sat Feb 14 18:41:23 2004
***************
*** 537,554 ****
scan = ir->Event.KeyEvent.wVirtualScanCode;
shiftstate = ir->Event.KeyEvent.dwControlKeyState;
vk = ir->Event.KeyEvent.wVirtualKeyCode;
! keycode = MapVirtualKey(vk, 2);
! if (is_altseq(shiftstate)) {
! if (ch || inmap(keycode,vk)) altseq = 1;
! else altseq = -1; /* invalid altseq */
! }
! if (ch || iskeypad(scan) || altseq) {
! done = 1; /* Stop looking */
! retval = 1; /* Found what we sought */
! } else {
! /* Strange Key event; let's purge it to avoid trouble */
ReadConsoleInput(hConIn,ir,1,&count);
}
}
else if ((ir->EventType == MOUSE_EVENT &&
--- 537,560 ----
scan = ir->Event.KeyEvent.wVirtualScanCode;
shiftstate = ir->Event.KeyEvent.dwControlKeyState;
vk = ir->Event.KeyEvent.wVirtualKeyCode;
! if (scan == 0 && vk == 0) {
! /* It's the bogus_key. Discard it */
ReadConsoleInput(hConIn,ir,1,&count);
}
+ else {
+ keycode = MapVirtualKey(vk, 2);
+ if (is_altseq(shiftstate)) {
+ if (ch || inmap(keycode,vk)) altseq = 1;
+ else altseq = -1; /* invalid altseq */
+ }
+ if (ch || iskeypad(scan) || altseq) {
+ done = 1; /* Stop looking */
+ retval = 1; /* Found what we sought */
+ } else {
+ /* Strange Key event; let's purge it to avoid trouble */
+ ReadConsoleInput(hConIn,ir,1,&count);
+ }
+ }
}
else if ((ir->EventType == MOUSE_EVENT &&
--cut here--cut here--cut here--cut here--cut here--cut here--cut here--
The problem occurs because NHkbhit() falsely returns true when the bogus_key
is the next event to be read; the main code at allmain.c line 326 then
calls Getchar() with no key waiting. The patch changes NHkbhit to
recognize the bogus_key (which has scan code and virtual key both set to
zero) and discard it.
--
--------------===============<[ Ray Chason ]>===============--------------
This message was stage-managed by IBM. So say Darl McBride and SCO.
Delendae sunt RIAA, MPAA et Windoze