154 {
155 string tabs =
MakeTabs( depth + 1 );
156 string child_path =
path;
157 int count =
g_Game.ConfigGetChildrenCount( child_path );
158 int i = 0;
159
160 bool name_printed = false;
161
163
164 for ( i = 0; i < count; i++ )
165 {
166 string child_name = "";
167 g_Game.ConfigGetChildName( child_path, i, child_name );
168 string c_child_path = child_path + " " + child_name;
169
170 string child_name_lower = child_name;
172
173 if ( overridden.Find(child_name_lower) == -1 )
174 {
175 if ( !name_printed )
176 {
177 result.Insert(
":" +
MakeTabs(depth, check_base_class_of_class) +
"!" +
name );
178 name_printed = true;
179 }
180 overridden.Insert( child_name_lower );
181
182 int type =
g_Game.ConfigGetType( c_child_path );
183
184 if ( type != CT_CLASS )
185 {
186 if ( type != CT_ARRAY )
187 {
188 result.Insert(
"-" + tabs +
"!" + child_name +
" = " +
g_Game.ConfigGetTextOut(c_child_path) );
189 }
190 else
191 {
192 result.Insert( "-" + tabs + "!" + child_name + "[] = {" );
193
195 g_Game.ConfigGetTextArray( c_child_path, strs );
196 string tabs_array =
MakeTabs( depth + 2 );
197 int j;
198 for ( j = 0; j < strs.Count(); j++ )
199 {
200 result.Insert( "-" + tabs + "!" + child_name + "[]" + j.ToStringLen(6) + "~" + strs.Get(j) + "," );
201 }
202
203 result.Insert( "-" + tabs + "!" + child_name + "[]" + j.ToStringLen(6) + "~}" );
204 }
205 }
206 else
207 {
208 array<string> overridden_sub = new array<string>;
209
210 if (
g_Game.ConfigGetChildrenCount(c_child_path) > 0 )
211 {
213 result.InsertAll( config1 );
214 }
215 else
216 {
217 result.Insert( ":" + tabs + "!" + child_name );
218 }
219
220 string cc_child_path = c_child_path;
221 string c_config_class_path = config_class_path;
222 string c_child_name = child_name;
223
224 int cc = 0;
225
226 while ( true )
227 {
228 string base_class = "";
229
230 g_Game.ConfigGetBaseName( cc_child_path, base_class );
231
232 int start = c_config_class_path.
Length() + 1;
233 int len = cc_child_path.
Length();
234 len -= c_config_class_path.
Length() + c_child_name.
Length();
235 len -= 2;
236
237 if ( base_class != "" )
238 {
239 string only_child_path = "";
240 if ( len < 0 )
241 {
242 only_child_path = base_class;
243 }
244 else
245 {
246 only_child_path = cc_child_path.
Substring( start, len ) +
" " + base_class;
247 }
248
250 string base_class_path =
GetBaseClassPath( c_config_class_path, c_base_child_path, config_class );
251
252 if ( base_class_path != "" )
253 {
255 result.InsertAll( config2 );
256 }
257 else
258 {
260 result.InsertAll( config3 );
261
262 break;
263 }
264
265 cc_child_path = base_class_path;
266 c_child_name = base_class;
267 c_config_class_path = cc_child_path.
Substring( 0, cc_child_path.
Length() - only_child_path.
Length() - 1);
268 }
269 else
270 {
271 break;
272 }
273 }
274 }
275 }
276 }
277
278 if ( name_printed )
279 {
280 result.Insert(
":" +
MakeTabs(depth, check_base_class_of_class) +
"#" +
name );
281 }
282
283 if ( !check_base_class_of_class )
284 {
286 g_Game.ConfigGetFullPath( child_path, full_path );
287
288 if ( full_path.Count() > 1 )
289 {
290 TStringArray config4 =
GetConfigRecursive( config_class +
" " + full_path.Get(1), full_path.Get(1), config_class +
" " + full_path.Get(1), config_class, overridden, depth );
291 result.InsertAll( config4 );
292 }
293 }
294 else
295 {
296 string class_base_class = "";
297 g_Game.ConfigGetBaseName( child_path, class_base_class );
298
299 if ( class_base_class != "" )
300 {
302 string cc_base_child_path =
GetBaseClassPath( config_class_path, base_child_path, config_class );
303
304 if ( cc_base_child_path != "" )
305 {
307 result.InsertAll( config5 );
308 }
309 else
310 {
312 result.InsertAll( config6 );
313 }
314 }
315 }
316
317 return result;
318 }
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
string GetBaseClassPathCombined(string child_path, string base_class)
string GetBaseClassPath(string config_class_path, string class_path, string config_class)
TStringArray GetConfigRecursive(string path, string name, string config_class_path, string config_class, local array< string > overridden, int depth=0, local bool check_base_class_of_class=false)
string MakeTabs(int count, bool inheritance=false)
array< string > TStringArray
proto native int Length()
Returns length of string.
proto string Substring(int start, int len)
Substring of 'str' from 'start' position 'len' number of characters.
proto int ToLower()
Changes string to lowercase. Returns length.