# HG changeset patch # User Xeli # Date 1338225351 -7200 # Node ID 29948153fda23ea2eb9470c7b7b087bb231b9abb # Parent a47fd17ba463cd923836f4609eb2dad69d9cd9f6 Don't allow for multiple key up(or down) events, it will ignore the excess events diff -r a47fd17ba463 -r 29948153fda2 hedgewars/uInputHandler.pas --- a/hedgewars/uInputHandler.pas Mon May 28 12:21:54 2012 -0400 +++ b/hedgewars/uInputHandler.pas Mon May 28 19:15:51 2012 +0200 @@ -64,12 +64,17 @@ Trusted: boolean; s : string; begin + +if(tkbd[code] = ord(KeyDown)) then exit; +tkbd[code]:= ord(KeyDown); + + hideAmmoMenu:= false; Trusted:= (CurrentTeam <> nil) and (not CurrentTeam^.ExtDriven) and (CurrentHedgehog^.BotLevel = 0); -tkbd[code]:= ord(KeyDown); + // ctrl/cmd + q to close engine and frontend if(KeyDown and (code = quitKeyCode)) then @@ -86,13 +91,13 @@ begin if (code > 3) and (KeyDown) and not ((CurrentBinds[code] = 'put') or (CurrentBinds[code] = 'ammomenu') or (CurrentBinds[code] = '+cur_u') or (CurrentBinds[code] = '+cur_d') or (CurrentBinds[code] = '+cur_l') or (CurrentBinds[code] = '+cur_r')) then hideAmmoMenu:= true; - if (KeyDown) then + if KeyDown then begin ParseCommand(CurrentBinds[code], Trusted); if (CurrentTeam <> nil) and (not CurrentTeam^.ExtDriven) and (ReadyTimeLeft > 1) then ParseCommand('gencmd R', true) end - else if (CurrentBinds[code][1] = '+') and not KeyDown then + else if (CurrentBinds[code][1] = '+') then begin s:= CurrentBinds[code]; s[1]:= '-'; @@ -101,7 +106,6 @@ ParseCommand('gencmd R', true) end; end - end; procedure ProcessKey(event: TSDL_KeyboardEvent); inline;