=============== Menus_CloseByName =============== */
| 1660 | =============== |
| 1661 | */ |
| 1662 | void 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 | =============== |
no test coverage detected