mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-12 23:54:17 +00:00
fix options search when menus are defined recursively
This commit is contained in:
parent
355e367a08
commit
3102640210
1 changed files with 19 additions and 8 deletions
|
@ -31,7 +31,8 @@ class os_Menu : OptionMenu
|
||||||
|
|
||||||
addSearchField(text);
|
addSearchField(text);
|
||||||
|
|
||||||
bool found = listOptions(mDesc, "MainMenu", query, "", isAnyTermMatches);
|
Dictionary searchedMenus = Dictionary.Create();
|
||||||
|
bool found = listOptions(mDesc, "MainMenu", query, "", isAnyTermMatches, searchedMenus);
|
||||||
|
|
||||||
if (!found) { addNoResultsItem(mDesc); }
|
if (!found) { addNoResultsItem(mDesc); }
|
||||||
|
|
||||||
|
@ -54,21 +55,29 @@ class os_Menu : OptionMenu
|
||||||
string menuName,
|
string menuName,
|
||||||
os_Query query,
|
os_Query query,
|
||||||
string path,
|
string path,
|
||||||
bool isAnyTermMatches)
|
bool isAnyTermMatches,
|
||||||
|
Dictionary searchedMenus)
|
||||||
{
|
{
|
||||||
|
if (searchedMenus.At(menuName).length() > 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
searchedMenus.Insert(menuName, "1");
|
||||||
|
|
||||||
let desc = MenuDescriptor.GetDescriptor(menuName);
|
let desc = MenuDescriptor.GetDescriptor(menuName);
|
||||||
let listMenuDesc = ListMenuDescriptor(desc);
|
let listMenuDesc = ListMenuDescriptor(desc);
|
||||||
|
|
||||||
if (listMenuDesc)
|
if (listMenuDesc)
|
||||||
{
|
{
|
||||||
return listOptionsListMenu(listMenuDesc, targetDesc, query, path, isAnyTermMatches);
|
return listOptionsListMenu(listMenuDesc, targetDesc, query, path, isAnyTermMatches, searchedMenus);
|
||||||
}
|
}
|
||||||
|
|
||||||
let optionMenuDesc = OptionMenuDescriptor(desc);
|
let optionMenuDesc = OptionMenuDescriptor(desc);
|
||||||
|
|
||||||
if (optionMenuDesc)
|
if (optionMenuDesc)
|
||||||
{
|
{
|
||||||
return listOptionsOptionMenu(optionMenuDesc, targetDesc, query, path, isAnyTermMatches);
|
return listOptionsOptionMenu(optionMenuDesc, targetDesc, query, path, isAnyTermMatches, searchedMenus);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -78,7 +87,8 @@ class os_Menu : OptionMenu
|
||||||
OptionMenuDescriptor targetDesc,
|
OptionMenuDescriptor targetDesc,
|
||||||
os_Query query,
|
os_Query query,
|
||||||
string path,
|
string path,
|
||||||
bool isAnyTermMatches)
|
bool isAnyTermMatches,
|
||||||
|
Dictionary searchedMenus)
|
||||||
{
|
{
|
||||||
int nItems = sourceDesc.mItems.size();
|
int nItems = sourceDesc.mItems.size();
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
@ -92,7 +102,7 @@ class os_Menu : OptionMenu
|
||||||
? makePath(path, StringTable.Localize(textItem.mText))
|
? makePath(path, StringTable.Localize(textItem.mText))
|
||||||
: path;
|
: path;
|
||||||
|
|
||||||
found |= listOptions(targetDesc, actionN, query, newPath, isAnyTermMatches);
|
found |= listOptions(targetDesc, actionN, query, newPath, isAnyTermMatches, searchedMenus);
|
||||||
}
|
}
|
||||||
|
|
||||||
return found;
|
return found;
|
||||||
|
@ -102,7 +112,8 @@ class os_Menu : OptionMenu
|
||||||
OptionMenuDescriptor targetDesc,
|
OptionMenuDescriptor targetDesc,
|
||||||
os_Query query,
|
os_Query query,
|
||||||
string path,
|
string path,
|
||||||
bool isAnyTermMatches)
|
bool isAnyTermMatches,
|
||||||
|
Dictionary searchedMenus)
|
||||||
{
|
{
|
||||||
if (sourceDesc == targetDesc) { return false; }
|
if (sourceDesc == targetDesc) { return false; }
|
||||||
|
|
||||||
|
@ -152,7 +163,7 @@ class os_Menu : OptionMenu
|
||||||
{
|
{
|
||||||
string newPath = makePath(path, label);
|
string newPath = makePath(path, label);
|
||||||
|
|
||||||
found |= listOptions(targetDesc, item.GetAction(), query, newPath, isAnyTermMatches);
|
found |= listOptions(targetDesc, item.GetAction(), query, newPath, isAnyTermMatches, searchedMenus);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue