935 {
936 widget.ClearItems();
937
940
941 string widgetText;
942 filterWidget.GetText(widgetText);
944
945 map<string,int> itemsAndColors = new map<string,int>();
947
949
950 for (int i = 0; i < classes.Count(); i++)
951 {
952 string config_path = classes.Get(i);
953
954 int objects_count =
g_Game.ConfigGetChildrenCount(config_path);
955 for (int j = 0; j < objects_count; j++)
956 {
957 string child_name;
958
959 g_Game.ConfigGetChildName(config_path, j, child_name);
960
961 int scope =
g_Game.ConfigGetInt(config_path +
" " + child_name +
" scope");
962
964 {
965 int category_bit =
g_Game.ConfigGetInt(config_path +
" " + child_name +
" debug_ItemCategory") - 1;
966 category_bit = (1 << category_bit);
967
968 bool display = false;
969 int color = 0;
970 if (category_bit & categoryMask)
971 {
972 display = true;
973 }
975 {
976 string child_name_lower = child_name;
978
979 foreach (int indx, string filter:filters)
980 {
981 if (child_name_lower.
Contains(filter))
982 {
983 display = false;
984 color = filterColors.Get(indx);
986 if (!arr)
987 {
989 itemsByFilters.Set(filter, arr);
990 }
991 arr.Insert(child_name);
992 itemsAndColors.Insert(child_name,color);
993 break;
994 }
995 }
996 }
997 else if (categoryMask == 0)
998 {
999 display = true;
1000 }
1001
1002 if (display)
1003 {
1004 itemsArray.Insert(child_name);
1005
1006 }
1007 }
1008 }
1009 }
1010
1011 if (itemsArray)
1012 {
1013 itemsArray.Sort();
1014 foreach (string it:itemsArray)
1015 {
1016 widget.AddItem(it, NULL, 0);
1017 }
1018 }
1019
1020 if (filters)
1021 {
1023 filters.Invert();
1024
1025 foreach (string f:filters)
1026 {
1028 if (arr2)
1029 {
1030 arr2.Sort();
1031 foreach (string itm: arr2)
1032 {
1033 int row = widget.AddItem(itm, NULL, 0);
1034 int clr = itemsAndColors.Get(itm);
1035 if (clr)
1036 {
1037 widget.SetItemColor(row, 0, clr);
1038 }
1039 }
1040 }
1041 }
1042 }
1043
1044
1045 }
void PrepareFilters(string filter, out TStringArray filters, out TIntArray colors)
static int m_ObjectsScope
bool m_FilterOrderReversed
PluginConfigDebugProfile m_ConfigDebugProfile
array< string > TStringArray
bool Contains(string sample)
Returns true if sample is substring of string.
proto int ToLower()
Changes string to lowercase. Returns length.