Change KeyBindToName to shortstring
authorWuzzy <Wuzzy2@mail.ru>
Tue, 24 Apr 2018 20:30:15 +0200
changeset 13343 93325e13d329
parent 13342 774dd8762607
child 13344 4f9108f82879
Change KeyBindToName to shortstring Key names do not and should not be longer than 255 characters. ;-)
hedgewars/uInputHandler.pas
hedgewars/uStore.pas
--- a/hedgewars/uInputHandler.pas	Tue Apr 24 19:52:04 2018 +0200
+++ b/hedgewars/uInputHandler.pas	Tue Apr 24 20:30:15 2018 +0200
@@ -29,7 +29,7 @@
 function  KeyNameToCode(name: shortstring; Modifier: shortstring): LongInt;
 
 function  KeyBindToCode(bind: shortstring): LongInt;
-function  KeyBindToName(bind: shortstring): ansistring;
+function  KeyBindToName(bind: shortstring): shortstring;
 //procedure MaskModifier(var code: LongInt; modifier: LongWord);
 procedure MaskModifier(Modifier: shortstring; var code: LongInt);
 procedure ProcessMouse(event: TSDL_MouseButtonEvent; ButtonDown: boolean);
@@ -119,9 +119,9 @@
 // FIXME: Does not work 100% for all keys yet, but at least it no
 //        longer hardcodes any key name.
 // TODO: Localize
-function KeyBindToName(bind: shortstring): ansistring;
+function KeyBindToName(bind: shortstring): shortstring;
 var code: LongInt;
-    name: ansistring;
+    name: shortstring;
 begin
     code:= KeyBindToCode(bind);
     if code = -1 then
@@ -132,7 +132,7 @@
         if (name = 'Escape') then
             // Let's shorten the name “Escape” for the quit menu
             KeyBindToName:= 'Esc'
-        else if (name <> '') then
+        else if (length(name) <> 0) then
             KeyBindToName:= name
         else
             begin
--- a/hedgewars/uStore.pas	Tue Apr 24 19:52:04 2018 +0200
+++ b/hedgewars/uStore.pas	Tue Apr 24 20:30:15 2018 +0200
@@ -379,7 +379,7 @@
     ai: TAmmoType;
     tmpsurf, tmpoverlay: PSDL_Surface;
     i, y, imflags: LongInt;
-    keyConfirm, keyQuit: ansistring;
+    keyConfirm, keyQuit: shortstring;
 begin
 AddFileLog('StoreLoad()');
 
@@ -509,7 +509,7 @@
     AFKTexture:= RenderStringTex(trmsg[sidAFK], cYellowColor, fntBig);
     keyConfirm:= KeyBindToName('confirm');
     keyQuit:= KeyBindToName('quit');
-    ConfirmTexture:= RenderStringTex(FormatA(trmsg[sidConfirm], [keyConfirm, keyQuit]), cYellowColor, fntBig);
+    ConfirmTexture:= RenderStringTex(Format(trmsg[sidConfirm], [keyConfirm, keyQuit]), cYellowColor, fntBig);
     SyncTexture:= RenderStringTex(trmsg[sidSync], cYellowColor, fntBig);
 
     if not reload then