equal
deleted
inserted
replaced
23 interface |
23 interface |
24 uses uTypes, uFloat; |
24 uses uTypes, uFloat; |
25 |
25 |
26 procedure SplitBySpace(var a, b: shortstring); |
26 procedure SplitBySpace(var a, b: shortstring); |
27 procedure SplitByChar(var a, b: shortstring; c: char); |
27 procedure SplitByChar(var a, b: shortstring; c: char); |
28 |
28 procedure SplitByCharA(var a, b: ansistring; c: char); |
29 {$IFNDEF PAS2C} |
|
30 procedure SplitByChar(var a, b: ansistring; c: char); |
|
31 {$ENDIF} |
|
32 |
29 |
33 function EnumToStr(const en : TGearType) : shortstring; overload; |
30 function EnumToStr(const en : TGearType) : shortstring; overload; |
34 function EnumToStr(const en : TVisualGearType) : shortstring; overload; |
31 function EnumToStr(const en : TVisualGearType) : shortstring; overload; |
35 function EnumToStr(const en : TSound) : shortstring; overload; |
32 function EnumToStr(const en : TSound) : shortstring; overload; |
36 function EnumToStr(const en : TAmmoType) : shortstring; overload; |
33 function EnumToStr(const en : TAmmoType) : shortstring; overload; |
128 else |
125 else |
129 b:= ''; |
126 b:= ''; |
130 end; |
127 end; |
131 |
128 |
132 {$IFNDEF PAS2C} |
129 {$IFNDEF PAS2C} |
133 procedure SplitByChar(var a, b: ansistring; c: char); |
130 procedure SetLengthA(var s: ansistring; len: Longword); |
|
131 begin |
|
132 SetLength(s, len) |
|
133 end; |
|
134 {$ENDIF} |
|
135 |
|
136 procedure SplitByCharA(var a, b: ansistring; c: char); |
134 var i: LongInt; |
137 var i: LongInt; |
135 begin |
138 begin |
136 i:= Pos(c, a); |
139 i:= Pos(c, a); |
137 if i > 0 then |
140 if i > 0 then |
138 begin |
141 begin |
139 b:= copy(a, i + 1, Length(a) - i); |
142 b:= copy(a, i + 1, Length(a) - i); |
140 setlength(a, Pred(i)); |
143 SetLengthA(a, Pred(i)); |
141 end else b:= ''; |
144 end else b:= ''; |
142 end; { SplitByChar } |
145 end; { SplitByCharA } |
143 {$ENDIF} |
|
144 |
146 |
145 function EnumToStr(const en : TGearType) : shortstring; overload; |
147 function EnumToStr(const en : TGearType) : shortstring; overload; |
146 begin |
148 begin |
147 EnumToStr:= GetEnumName(TypeInfo(TGearType), ord(en)) |
149 EnumToStr:= GetEnumName(TypeInfo(TGearType), ord(en)) |
148 end; |
150 end; |
309 begin |
311 begin |
310 for i:= 1 to Length(s) do |
312 for i:= 1 to Length(s) do |
311 begin |
313 begin |
312 CharArray[i - 1] := s[i]; |
314 CharArray[i - 1] := s[i]; |
313 end; |
315 end; |
314 CharArray[Length(s)]:= #0; |
316 CharArray[Length(s)]:= #0; |
315 Str2PChar:= @(CharArray[0]); |
317 Str2PChar:= @(CharArray[0]); |
316 end; |
318 end; |
317 |
319 |
318 |
320 |
319 function endian(independent: LongWord): LongWord; inline; |
321 function endian(independent: LongWord): LongWord; inline; |
375 // remove chinese fonts for now |
377 // remove chinese fonts for now |
376 if (font >= CJKfnt16) or (length(s) = 0) then |
378 if (font >= CJKfnt16) or (length(s) = 0) then |
377 {$ENDIF} |
379 {$ENDIF} |
378 exit; |
380 exit; |
379 |
381 |
380 l:= Utf8ToUnicode(@tmpstr, PChar(s), min(length(tmpstr), length(s)))-1; |
382 l:= Utf8ToUnicode(PWideChar(@tmpstr), PChar(s), min(length(tmpstr), length(s)))-1; |
381 i:= 0; |
383 i:= 0; |
382 |
384 |
383 while i < l do |
385 while i < l do |
384 begin |
386 begin |
385 u:= tmpstr[i]; |
387 u:= tmpstr[i]; |