equal
deleted
inserted
replaced
770 // Load default clan colors from config fiile |
770 // Load default clan colors from config fiile |
771 procedure LoadDefaultClanColors(s: shortstring); |
771 procedure LoadDefaultClanColors(s: shortstring); |
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: Longword; |
775 color, tempColor: Longword; |
776 c: byte; |
776 clanID, tempClanID: byte; |
|
777 conversionSuccess: boolean; |
777 begin |
778 begin |
778 if cOnlyStats then exit; |
779 if cOnlyStats then exit; |
779 |
780 |
780 WriteLnToConsole('Loading default clan colors from: ' + s); |
781 WriteLnToConsole('Loading default clan colors from: ' + s); |
781 |
782 |
784 begin |
785 begin |
785 f:= pfsOpenRead(s); |
786 f:= pfsOpenRead(s); |
786 while (not pfsEOF(f)) and (l <> '[colors]') do |
787 while (not pfsEOF(f)) and (l <> '[colors]') do |
787 pfsReadLn(f, l); |
788 pfsReadLn(f, l); |
788 |
789 |
|
790 conversionSuccess:= false; |
789 while (not pfsEOF(f)) and (l <> '') do |
791 while (not pfsEOF(f)) and (l <> '') do |
790 begin |
792 begin |
791 pfsReadLn(f, l); |
793 pfsReadLn(f, l); |
792 |
794 |
793 key:= ''; |
795 key:= ''; |
799 end; |
801 end; |
800 temp:= copy(key, 1, 5); |
802 temp:= copy(key, 1, 5); |
801 if temp = 'color' then |
803 if temp = 'color' then |
802 begin |
804 begin |
803 temp:= copy(key, 6, length(key) - 5); |
805 temp:= copy(key, 6, length(key) - 5); |
804 try |
806 tempClanID:= StrToInt(temp, conversionSuccess); |
805 c:= StrToInt(temp); |
807 if conversionSuccess then |
806 except |
808 clanID:= tempClanID |
807 on E : EConvertError do continue; |
809 else |
808 end; |
810 continue; |
809 end |
811 end |
810 else |
812 else |
811 continue; |
813 continue; |
812 |
814 |
813 if i < length(l) then |
815 if i < length(l) then |
818 else if (value[1] = '"') and (value[length(value)] = '"') then |
820 else if (value[1] = '"') and (value[length(value)] = '"') then |
819 value:= copy(value, 2, length(value) - 2); |
821 value:= copy(value, 2, length(value) - 2); |
820 if value[1] <> '#' then |
822 if value[1] <> '#' then |
821 continue; |
823 continue; |
822 temp:= copy(value, 2, length(value) - 1); |
824 temp:= copy(value, 2, length(value) - 1); |
823 try |
825 tempColor:= StrToInt('0x'+temp, conversionSuccess); |
824 color:= StrToInt('0x'+temp); |
826 if conversionSuccess then |
825 except |
827 color:= tempColor |
826 on E : EConvertError do continue; |
828 else |
|
829 continue; |
827 end; |
830 end; |
828 end; |
831 |
829 |
832 if clanID <= cClanColors then |
830 if c <= cClanColors then |
833 ClanColorArray[clanID]:= color; |
831 ClanColorArray[c]:= color; |
|
832 |
834 |
833 end; |
835 end; |
834 |
836 |
835 pfsClose(f) |
837 pfsClose(f) |
836 end |
838 end |