hedgewars/uStore.pas
changeset 13846 b2cc4e4e380c
parent 13837 10a3b80130b5
child 13881 aa321e51da14
--- a/hedgewars/uStore.pas	Wed Sep 05 20:09:32 2018 +0200
+++ b/hedgewars/uStore.pas	Thu Oct 04 21:17:21 2018 +0200
@@ -511,7 +511,7 @@
     AFKTexture:= RenderStringTex(trmsg[sidAFK], cCentralMessageColor, fntBig);
     keyConfirm:= KeyBindToName('confirm');
     keyQuit:= KeyBindToName('quit');
-    ConfirmTexture:= RenderStringTex(Format(trmsg[sidConfirm], [keyConfirm, keyQuit]), cCentralMessageColor, fntBig);
+    ConfirmTexture:= RenderStringTex(Format(trmsg[sidConfirm], keyConfirm, keyQuit), cCentralMessageColor, fntBig);
     SyncTexture:= RenderStringTex(trmsg[sidSync], cCentralMessageColor, fntBig);
 
     if not reload then
@@ -772,8 +772,9 @@
 var i: LongInt;
     f: PFSFile;
     key, value, l, temp: shortstring;
-    color: Longword;
-    c: byte;
+    color, tempColor: Longword;
+    clanID, tempClanID: byte;
+    conversionSuccess: boolean;
 begin
     if cOnlyStats then exit;
 
@@ -786,6 +787,7 @@
         while (not pfsEOF(f)) and (l <> '[colors]') do
             pfsReadLn(f, l);
 
+        conversionSuccess:= false;
         while (not pfsEOF(f)) and (l <> '') do
             begin
             pfsReadLn(f, l);
@@ -801,11 +803,11 @@
             if temp = 'color' then
                 begin
                 temp:= copy(key, 6, length(key) - 5);
-                try
-                    c:= StrToInt(temp);
-                except
-                    on E : EConvertError do continue;
-                end;
+                tempClanID:= StrToInt(temp, conversionSuccess);
+                if conversionSuccess then
+                    clanID:= tempClanID
+                else
+                    continue;
                 end
             else
                 continue;
@@ -820,15 +822,15 @@
                 if value[1] <> '#' then
                     continue;
                 temp:= copy(value, 2, length(value) - 1);
-                try
-                    color:= StrToInt('0x'+temp);
-                except
-                    on E : EConvertError do continue;
-                end;
+                tempColor:= StrToInt('0x'+temp, conversionSuccess);
+                if conversionSuccess then
+                    color:= tempColor
+                else
+                    continue;
                 end;
 
-            if c <= cClanColors then
-                ClanColorArray[c]:= color;
+            if clanID <= cClanColors then
+                ClanColorArray[clanID]:= color;
 
             end;