MCPcopy Create free account
hub / github.com/alliedmodders/sourcemod / _CancelClientMenu

Method _CancelClientMenu

core/MenuStyle_Base.cpp:75–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73}
74
75void 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
115void BaseMenuStyle::CancelMenu(CBaseMenu *menu)
116{

Callers

nothing calls this directly

Calls 3

LogMessageMethod · 0.45
OnMenuCancelMethod · 0.45
OnMenuEndMethod · 0.45

Tested by

no test coverage detected