| 410 | } |
| 411 | |
| 412 | bool BaseMenuStyle::DoClientMenu(int client, IMenuPanel *menu, IMenuHandler *mh, unsigned int time) |
| 413 | { |
| 414 | #if defined MENU_DEBUG |
| 415 | logger->LogMessage("[SM_MENU] DoClientMenu() (client %d) (panel %p) (mh %p) (time %d)", |
| 416 | client, |
| 417 | menu, |
| 418 | mh, |
| 419 | time); |
| 420 | #endif |
| 421 | CPlayer *pPlayer = g_Players.GetPlayerByIndex(client); |
| 422 | if (!pPlayer || !pPlayer->IsInGame()) |
| 423 | { |
| 424 | return false; |
| 425 | } |
| 426 | |
| 427 | CBaseMenuPlayer *player = GetMenuPlayer(client); |
| 428 | if (player->bAutoIgnore) |
| 429 | { |
| 430 | return false; |
| 431 | } |
| 432 | |
| 433 | /* For the duration of this, we are going to totally ignore whether |
| 434 | * the player is already in a menu or not (except to cancel the old one). |
| 435 | * Instead, we are simply going to ignore any further menu displays, so |
| 436 | * this display can't be interrupted. |
| 437 | */ |
| 438 | player->bAutoIgnore = true; |
| 439 | |
| 440 | /* Cancel any old menus */ |
| 441 | menu_states_t &states = player->states; |
| 442 | if (player->bInMenu) |
| 443 | { |
| 444 | _CancelClientMenu(client, MenuCancel_Interrupted, true); |
| 445 | } |
| 446 | |
| 447 | states.firstItem = 0; |
| 448 | states.lastItem = 0; |
| 449 | states.menu = NULL; |
| 450 | states.mh = mh; |
| 451 | states.apiVers = SMINTERFACE_MENUMANAGER_VERSION; |
| 452 | player->bInMenu = true; |
| 453 | player->bInExternMenu = false; |
| 454 | player->menuStartTime = gpGlobals->curtime; |
| 455 | player->menuHoldTime = time; |
| 456 | |
| 457 | if (time) |
| 458 | { |
| 459 | AddClientToWatch(client); |
| 460 | } |
| 461 | |
| 462 | /* Draw the display */ |
| 463 | SendDisplay(client, menu); |
| 464 | |
| 465 | /* We can be interrupted again! */ |
| 466 | player->bAutoIgnore = false; |
| 467 | |
| 468 | return true; |
| 469 | } |
no test coverage detected