hedgewars/uStore.pas
changeset 13884 6b2c87490f0a
parent 13881 aa321e51da14
child 13966 4355b8c4099e
equal deleted inserted replaced
13883:0ce8aad17c24 13884:6b2c87490f0a
   772 var i: LongInt;
   772 var i: LongInt;
   773     f: PFSFile;
   773     f: PFSFile;
   774     key, value, l, temp: shortstring;
   774     key, value, l, temp: shortstring;
   775     color, tempColor: Longword;
   775     color, tempColor: Longword;
   776     clanID, tempClanID: byte;
   776     clanID, tempClanID: byte;
   777     conversionSuccess: boolean;
       
   778 begin
   777 begin
   779     if cOnlyStats then exit;
   778     if cOnlyStats then exit;
   780 
   779 
   781     WriteLnToConsole('Loading default clan colors from: ' + s);
   780     WriteLnToConsole('Loading default clan colors from: ' + s);
   782 
   781 
   785         begin
   784         begin
   786         f:= pfsOpenRead(s);
   785         f:= pfsOpenRead(s);
   787         while (not pfsEOF(f)) and (l <> '[colors]') do
   786         while (not pfsEOF(f)) and (l <> '[colors]') do
   788             pfsReadLn(f, l);
   787             pfsReadLn(f, l);
   789 
   788 
   790         conversionSuccess:= false;
       
   791         while (not pfsEOF(f)) and (l <> '') do
   789         while (not pfsEOF(f)) and (l <> '') do
   792             begin
   790             begin
   793             pfsReadLn(f, l);
   791             pfsReadLn(f, l);
   794 
   792 
   795             key:= '';
   793             key:= '';
   801                 end;
   799                 end;
   802             temp:= copy(key, 1, 5);
   800             temp:= copy(key, 1, 5);
   803             if temp = 'color' then
   801             if temp = 'color' then
   804                 begin
   802                 begin
   805                 temp:= copy(key, 6, length(key) - 5);
   803                 temp:= copy(key, 6, length(key) - 5);
   806                 tempClanID:= StrToInt(temp, conversionSuccess);
   804                 tempClanID:= StrToInt(temp);
   807                 if conversionSuccess then
   805                 clanID:= tempClanID
   808                     clanID:= tempClanID
       
   809                 else
       
   810                     continue;
       
   811                 end
   806                 end
   812             else
   807             else
   813                 continue;
   808                 continue;
   814 
   809 
   815             if i < length(l) then
   810             if i < length(l) then
   820                 else if (value[1] = '"') and (value[length(value)] = '"') then
   815                 else if (value[1] = '"') and (value[length(value)] = '"') then
   821                     value:= copy(value, 2, length(value) - 2);
   816                     value:= copy(value, 2, length(value) - 2);
   822                 if value[1] <> '#' then
   817                 if value[1] <> '#' then
   823                     continue;
   818                     continue;
   824                 temp:= copy(value, 2, length(value) - 1);
   819                 temp:= copy(value, 2, length(value) - 1);
   825                 tempColor:= StrToInt('0x'+temp, conversionSuccess);
   820                 tempColor:= StrToInt('0x'+temp);
   826                 if conversionSuccess then
   821 				color:= tempColor
   827                     color:= tempColor
       
   828                 else
       
   829                     continue;
       
   830                 end;
   822                 end;
   831 
   823 
   832             if clanID <= cClanColors then
   824             if clanID <= cClanColors then
   833                 ClanColorArray[clanID]:= color;
   825                 ClanColorArray[clanID]:= color;
   834 
   826