61 pfsReadLnA(f, s); |
61 pfsReadLnA(f, s); |
62 if Length(s) = 0 then |
62 if Length(s) = 0 then |
63 continue; |
63 continue; |
64 if (s[1] < '0') or (s[1] > '9') then |
64 if (s[1] < '0') or (s[1] > '9') then |
65 continue; |
65 continue; |
66 TryDo(Length(s) > 6, 'Load locale: empty string', true); |
66 checkFails(Length(s) > 6, 'Load locale: empty string', true); |
67 {$IFNDEF PAS2C} |
67 {$IFNDEF PAS2C} |
68 val(s[1]+s[2], a, c); |
68 val(s[1]+s[2], a, c); |
69 TryDo(c = 0, ansistring('Load locale: numbers should be two-digit: ') + s, true); |
69 checkFails(c = 0, ansistring('Load locale: numbers should be two-digit: ') + s, true); |
70 val(s[4]+s[5], b, c); |
70 val(s[4]+s[5], b, c); |
71 TryDo(c = 0, ansistring('Load locale: numbers should be two-digit: ') + s, true); |
71 checkFails(c = 0, ansistring('Load locale: numbers should be two-digit: ') + s, true); |
72 {$ELSE} |
72 {$ELSE} |
73 val(s[1]+s[2], a); |
73 val(s[1]+s[2], a); |
74 val(s[4]+s[5], b); |
74 val(s[4]+s[5], b); |
75 {$ENDIF} |
75 {$ENDIF} |
76 TryDo(s[3] = ':', 'Load locale: ":" expected', true); |
76 checkFails(s[3] = ':', 'Load locale: ":" expected', true); |
77 TryDo(s[6] = '=', 'Load locale: "=" expected', true); |
77 checkFails(s[6] = '=', 'Load locale: "=" expected', true); |
|
78 if not allOK then exit; |
78 Delete(s, 1, 6); |
79 Delete(s, 1, 6); |
79 case a of |
80 case a of |
80 0: if (b >=0) and (b <= ord(High(TAmmoStrId))) then |
81 0: if (b >=0) and (b <= ord(High(TAmmoStrId))) then |
81 trammo[TAmmoStrId(b)]:= s; |
82 trammo[TAmmoStrId(b)]:= s; |
82 1: if (b >=0) and (b <= ord(High(TMsgStrId))) then |
83 1: if (b >=0) and (b <= ord(High(TMsgStrId))) then |
83 trmsg[TMsgStrId(b)]:= s; |
84 trmsg[TMsgStrId(b)]:= s; |
84 2: if (b >=0) and (b <= ord(High(TEventId))) then |
85 2: if (b >=0) and (b <= ord(High(TEventId))) then |
85 begin |
86 begin |
86 TryDo(trevt_n[TEventId(b)] < MAX_EVENT_STRINGS, 'Too many event strings in ' + IntToStr(a) + ':' + IntToStr(b), false); |
87 checkFails(trevt_n[TEventId(b)] < MAX_EVENT_STRINGS, 'Too many event strings in ' + IntToStr(a) + ':' + IntToStr(b), false); |
87 if first[TEventId(b)] then |
88 if first[TEventId(b)] then |
88 begin |
89 begin |
89 trevt_n[TEventId(b)]:= 0; |
90 trevt_n[TEventId(b)]:= 0; |
90 first[TEventId(b)]:= false; |
91 first[TEventId(b)]:= false; |
91 end; |
92 end; |