hedgewars/uKeys.pas
changeset 109 ab0340f580c2
parent 42 72ffe21f027c
child 161 d8870bbf960e
--- a/hedgewars/uKeys.pas	Fri Aug 11 20:00:29 2006 +0000
+++ b/hedgewars/uKeys.pas	Sat Aug 12 17:41:02 2006 +0000
@@ -43,8 +43,8 @@
 
 implementation
 uses SDLh, uTeams, uConsole, uConsts, uMisc;
-
-type TKeyboardState = array[0..322] of Byte;
+const KeyNumber = 1024;
+type TKeyboardState = array[0..cKeyMaxIndex] of Byte;
 var tkbd: TKeyboardState;
     KeyNames: array [0..cKeyMaxIndex] of string[15];
 
@@ -101,6 +101,7 @@
     pkbd: PByteArray;
 begin
 pkbd:= PByteArray(SDL_GetKeyState(@i));
+TryDo(i < cKeyMaxIndex, 'SDL keys number is more than expected (' + inttostr(i) + ')', true);
 for t:= 0 to Pred(i) do
     tkbd[i]:= pkbd^[i]
 end;