equal
deleted
inserted
replaced
19 var |
19 var |
20 scriptsList: PScript; |
20 scriptsList: PScript; |
21 scriptsNumber: Longword; |
21 scriptsNumber: Longword; |
22 listOfScriptNames: array[0..MAX_SCRIPT_NAMES] of PChar; |
22 listOfScriptNames: array[0..MAX_SCRIPT_NAMES] of PChar; |
23 |
23 |
24 procedure loadScript(var script: TScript; fileName: shortstring); |
24 procedure loadScript(var script: TScript; scriptName, fileName: shortstring); |
25 var f: PFSFile; |
25 var f: PFSFile; |
26 section: LongInt; |
|
27 l: shortstring; |
|
28 begin |
26 begin |
29 section:= -1; |
27 underScore2Space(scriptName); |
30 f:= pfsOpenRead(fileName); |
28 script.scriptName:= scriptName; |
|
29 script.description:= scriptName + ' script description'; |
31 |
30 |
32 while (not pfsEOF(f)) do |
31 f:= pfsOpenRead(copy(fileName, 1, length(fileName) - 4) + '.txt'); |
|
32 |
|
33 script.gameScheme:= ''; |
|
34 script.weapons:= ''; |
|
35 |
|
36 if f <> nil then |
33 begin |
37 begin |
34 pfsReadLn(f, l); |
38 if not pfsEOF(f) then |
35 end; |
39 begin |
|
40 pfsReadLn(f, script.gameScheme); |
36 |
41 |
37 pfsClose(f) |
42 if not pfsEOF(f) then |
|
43 pfsReadLn(f, script.weapons); |
|
44 end; |
|
45 |
|
46 pfsClose(f) |
|
47 end |
38 end; |
48 end; |
39 |
49 |
40 procedure loadScripts; |
50 procedure loadScripts; |
41 var filesList, tmp: PPChar; |
51 var filesList, tmp: PPChar; |
42 script: PScript; |
52 script: PScript; |
64 begin |
74 begin |
65 s:= shortstring(tmp^); |
75 s:= shortstring(tmp^); |
66 l:= length(s); |
76 l:= length(s); |
67 if (l > 4) and (copy(s, l - 3, 4) = '.lua') then |
77 if (l > 4) and (copy(s, l - 3, 4) = '.lua') then |
68 begin |
78 begin |
69 loadScript(script^, '/Config/Scripts/' + s); |
79 loadScript(script^, copy(s, 1, l - 4), '/Config/Scripts/' + s); |
70 inc(script) |
80 inc(script) |
71 end; |
81 end; |
72 inc(tmp) |
82 inc(tmp) |
73 end; |
83 end; |
74 |
84 |