175 {
176 widget.ClearItems();
177
180
181 map<string,ref TStringArray> itemsByFilters = new map<string,ref TStringArray>();
182
184
185 for (int i = 0; i < classes.Count(); i++)
186 {
187 string config_path = classes.Get(i);
188
189 int objects_count =
g_Game.ConfigGetChildrenCount(config_path);
190 for (int j = 0; j < objects_count; j++)
191 {
192 string child_name;
193 bool add = false;
194 g_Game.ConfigGetChildName(config_path, j, child_name);
195
196 if (!filters.Count())
197 {
198 add = true;
199 }
200 else
201 {
202 foreach (int indx, string filter:filters)
203 {
204 string child_name_lower = child_name;
206
207 if (child_name_lower.
Contains(filter))
208 {
209 add = true;
210 break;
211 }
212 }
213 }
214 if (add)
215 itemsArray.Insert(child_name);
216 }
217 }
218
219 if (itemsArray)
220 {
221 itemsArray.Sort();
222 foreach (string it:itemsArray)
223 {
224 widget.AddItem(it, NULL, 0);
225 }
226 }
227
228 if (filters)
229 {
230
231
232
233
234 foreach (string f:filters)
235 {
237 if (arr2)
238 {
239 arr2.Sort();
240 foreach (string itm: arr2)
241 {
242 int row = widget.AddItem(itm, NULL, 0);
243 }
244 }
245 }
246 }
247
248
249 }
void PrepareFilters(string filter, out TStringArray filters)
class array< Class T > TStringArray
bool Contains(string sample)
Returns true if sample is substring of string.
proto int ToLower()
Changes string to lowercase. Returns length.