| 73 | } |
| 74 | |
| 75 | void BaseMenuStyle::_CancelClientMenu(int client, MenuCancelReason reason, bool bAutoIgnore/* =false */) |
| 76 | { |
| 77 | #if defined MENU_DEBUG |
| 78 | logger->LogMessage("[SM_MENU] _CancelClientMenu() (client %d) (bAutoIgnore %d) (reason %d)", client, bAutoIgnore, reason); |
| 79 | #endif |
| 80 | CBaseMenuPlayer *player = GetMenuPlayer(client); |
| 81 | menu_states_t &states = player->states; |
| 82 | |
| 83 | bool bOldIgnore = player->bAutoIgnore; |
| 84 | if (bAutoIgnore) |
| 85 | { |
| 86 | player->bAutoIgnore = true; |
| 87 | } |
| 88 | |
| 89 | /* Save states */ |
| 90 | IMenuHandler *mh = states.mh; |
| 91 | IBaseMenu *menu = states.menu; |
| 92 | |
| 93 | /* Clear menu */ |
| 94 | player->bInMenu = false; |
| 95 | if (player->menuHoldTime) |
| 96 | { |
| 97 | RemoveClientFromWatch(client); |
| 98 | } |
| 99 | |
| 100 | /* Fire callbacks */ |
| 101 | mh->OnMenuCancel(menu, client, reason); |
| 102 | |
| 103 | /* Only fire end if there's a valid menu */ |
| 104 | if (menu) |
| 105 | { |
| 106 | mh->OnMenuEnd(menu, MenuEnd_Cancelled); |
| 107 | } |
| 108 | |
| 109 | if (bAutoIgnore) |
| 110 | { |
| 111 | player->bAutoIgnore = bOldIgnore; |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | void BaseMenuStyle::CancelMenu(CBaseMenu *menu) |
| 116 | { |
nothing calls this directly
no test coverage detected