MCPcopy Create free account
hub / github.com/JACoders/OpenJK / Menus_CloseByName

Function Menus_CloseByName

code/ui/ui_shared.cpp:1662–1696  ·  view source on GitHub ↗

=============== Menus_CloseByName =============== */

Source from the content-addressed store, hash-verified

1660===============
1661*/
1662void Menus_CloseByName(const char *p)
1663{
1664 menuDef_t *menu = Menus_FindByName(p);
1665
1666 // If the menu wasnt found just exit
1667 if (menu == NULL)
1668 {
1669 return;
1670 }
1671
1672 // Run the close script for the menu
1673 Menu_RunCloseScript(menu);
1674
1675 // If this window had the focus then take it away
1676 if ( menu->window.flags & WINDOW_HASFOCUS )
1677 {
1678 // If there is something still in the open menu list then
1679 // set it to have focus now
1680 if ( openMenuCount )
1681 {
1682 // Subtract one from the open menu count to prepare to
1683 // remove the top menu from the list
1684 openMenuCount -= 1;
1685
1686 // Set the top menu to have focus now
1687 menuStack[openMenuCount]->window.flags |= WINDOW_HASFOCUS;
1688
1689 // Remove the top menu from the list
1690 menuStack[openMenuCount] = NULL;
1691 }
1692 }
1693
1694 // Window is now invisible and doenst have focus
1695 menu->window.flags &= ~(WINDOW_VISIBLE | WINDOW_HASFOCUS);
1696}
1697
1698/*
1699===============

Callers 5

UI_RunMenuScriptFunction · 0.70
UI_DataPadMenuFunction · 0.70
UI_InGameMenuFunction · 0.70
UI_LoadMissionSelectMenuFunction · 0.70
Script_CloseFunction · 0.70

Calls 2

Menus_FindByNameFunction · 0.70
Menu_RunCloseScriptFunction · 0.70

Tested by

no test coverage detected