equal
deleted
inserted
replaced
3 uses uFLTypes; |
3 uses uFLTypes; |
4 |
4 |
5 function getSchemesList: PPChar; cdecl; |
5 function getSchemesList: PPChar; cdecl; |
6 procedure freeSchemesList; |
6 procedure freeSchemesList; |
7 |
7 |
|
8 function schemeByName(s: shortstring): PScheme; |
|
9 procedure sendSchemeConfig(var scheme: TScheme); |
|
10 |
8 implementation |
11 implementation |
9 uses uFLUtils, uFLIPC, uPhysFSLayer, uFLData; |
12 uses uFLUtils, uFLIPC, uPhysFSLayer, uFLData; |
10 |
13 |
11 const MAX_SCHEME_NAMES = 64; |
14 const MAX_SCHEME_NAMES = 64; |
12 type |
15 type |
13 TScheme = record |
|
14 schemeName |
|
15 , scriptparam : shortstring; |
|
16 fortsmode |
|
17 , divteams |
|
18 , solidland |
|
19 , border |
|
20 , lowgrav |
|
21 , laser |
|
22 , invulnerability |
|
23 , mines |
|
24 , vampiric |
|
25 , karma |
|
26 , artillery |
|
27 , randomorder |
|
28 , king |
|
29 , placehog |
|
30 , sharedammo |
|
31 , disablegirders |
|
32 , disablewind |
|
33 , morewind |
|
34 , tagteam |
|
35 , bottomborder: boolean; |
|
36 damagefactor |
|
37 , turntime |
|
38 , health |
|
39 , suddendeath |
|
40 , caseprobability |
|
41 , minestime |
|
42 , landadds |
|
43 , minedudpct |
|
44 , explosives |
|
45 , minesnum |
|
46 , healthprobability |
|
47 , healthcaseamount |
|
48 , waterrise |
|
49 , healthdecrease |
|
50 , ropepct |
|
51 , getawaytime |
|
52 , worldedge: LongInt |
|
53 end; |
|
54 PScheme = ^TScheme; |
|
55 TSchemeArray = array [0..0] of TScheme; |
16 TSchemeArray = array [0..0] of TScheme; |
56 PSchemeArray = ^TSchemeArray; |
17 PSchemeArray = ^TSchemeArray; |
57 var |
18 var |
58 schemesList: PScheme; |
19 schemesList: PScheme; |
59 schemesNumber: LongInt; |
20 schemesNumber: LongInt; |
150 if (l <= schemesNumber) and (l > 0) then |
111 if (l <= schemesNumber) and (l > 0) then |
151 begin |
112 begin |
152 scheme:= @schemes^[l - 1]; |
113 scheme:= @schemes^[l - 1]; |
153 |
114 |
154 if copy(s, 1, 5) = 'name=' then |
115 if copy(s, 1, 5) = 'name=' then |
155 tmpScheme. schemeName:= midStr(s, 6) |
116 tmpScheme.schemeName:= midStr(s, 6) |
156 else if copy(s, 1, 12) = 'scriptparam=' then |
117 else if copy(s, 1, 12) = 'scriptparam=' then |
157 tmpScheme. schemeName:= midStr(s, 13) else |
118 tmpScheme.scriptparam:= midStr(s, 13) else |
158 begin |
119 begin |
159 ii:= 0; |
120 ii:= 0; |
160 repeat |
121 repeat |
161 isFound:= readInt(ints[ii].name, s, ints[ii].param^); |
122 isFound:= readInt(ints[ii].name, s, ints[ii].param^); |
162 inc(ii) |
123 inc(ii) |
206 listOfSchemeNames[t]:= nil; |
167 listOfSchemeNames[t]:= nil; |
207 |
168 |
208 getSchemesList:= listOfSchemeNames |
169 getSchemesList:= listOfSchemeNames |
209 end; |
170 end; |
210 |
171 |
|
172 function schemeByName(s: shortstring): PScheme; |
|
173 var i: Longword; |
|
174 scheme: PScheme; |
|
175 begin |
|
176 scheme:= schemesList; |
|
177 i:= 0; |
|
178 while (i < schemesNumber) and (scheme^.schemeName <> s) do |
|
179 begin |
|
180 inc(scheme); |
|
181 inc(i) |
|
182 end; |
|
183 |
|
184 if i < schemesNumber then schemeByName:= scheme else schemeByName:= nil |
|
185 end; |
211 |
186 |
212 procedure freeSchemesList; |
187 procedure freeSchemesList; |
213 begin |
188 begin |
214 if schemesList <> nil then |
189 if schemesList <> nil then |
215 FreeMem(schemesList, sizeof(schemesList^) * (schemesNumber + 1)) |
190 FreeMem(schemesList, sizeof(schemesList^) * (schemesNumber + 1)) |
216 end; |
191 end; |
217 |
192 |
|
193 |
|
194 procedure sendSchemeConfig(var scheme: TScheme); |
|
195 var i: Longword; |
|
196 begin |
|
197 with scheme do |
|
198 begin |
|
199 ipcToEngine('e$turntime ' + inttostr(scheme.turntime)); |
|
200 ipcToEngine('e$minesnum ' + inttostr(scheme.minesnum)); |
|
201 end |
|
202 end; |
|
203 |
218 end. |
204 end. |