| 410 | return false; |
| 411 | } |
| 412 | void MenuItem::Execute(void) { |
| 413 | switch (m_cType) { |
| 414 | case MIT_NORMAL: { |
| 415 | // We need to go through the Submenus and check to see if the submenu has focus |
| 416 | // if it does, than we need to execute it's function |
| 417 | if (SubMenuCount > 0) { |
| 418 | if (CurrSubMenu != -1) { |
| 419 | if (HasInputFocus) { |
| 420 | // The submenu has focus, so call it's handler as long as it's not a plist type |
| 421 | char type = SubMenus[CurrSubMenu]->GetType(); |
| 422 | if ((type != MIT_PLIST) && (type != MIT_STATE) && (type != MIT_CUSTOM)) |
| 423 | SubMenus[CurrSubMenu]->CallFunc(CurrSubMenu); |
| 424 | return; |
| 425 | } |
| 426 | // The next submenu doesn't have focus, so move on and check it's submenu to see if we |
| 427 | // can Execute() that |
| 428 | SubMenus[CurrSubMenu]->Execute(); |
| 429 | } |
| 430 | } else { |
| 431 | // We don't have any SubMenus so try and call our handler |
| 432 | CallFunc(0); |
| 433 | } |
| 434 | } break; |
| 435 | case MIT_PLIST: { |
| 436 | // We need to go through the Submenus and check to see if the submenu has focus |
| 437 | // if it does, than we need to execute it's function |
| 438 | if ((SubMenuCount > 0) && (CurrSubMenu != -1) && (HasInputFocus)) { |
| 439 | if (m_iFlags & MIF_INCLUDENONE) { |
| 440 | // there is a <None> so take that into consideration |
| 441 | if (CurrSubMenu == 0) { |
| 442 | //<None> is selected |
| 443 | CallFunc(-1); |
| 444 | return; |
| 445 | } |
| 446 | |
| 447 | if (basethis->CheckPlayerNum(Pnums[CurrSubMenu - 1])) { |
| 448 | // The submenu has focus, so call it's handler |
| 449 | CallFunc(Pnums[CurrSubMenu - 1]); |
| 450 | return; |
| 451 | } |
| 452 | } else { |
| 453 | // a regular plist |
| 454 | if (basethis->CheckPlayerNum(Pnums[CurrSubMenu])) { |
| 455 | // The submenu has focus, so call it's handler |
| 456 | CallFunc(Pnums[CurrSubMenu]); |
| 457 | return; |
| 458 | } |
| 459 | } |
| 460 | } |
| 461 | } break; |
| 462 | case MIT_CUSTOM: { |
| 463 | // We need to go through the Submenus and check to see if the submenu has focus |
| 464 | // if it does, than we need to execute it's function |
| 465 | int count = (m_cmInfo.GetListCount) ? (*m_cmInfo.GetListCount)() : 0; |
| 466 | if (count > 0) { |
| 467 | if (CurrSubMenu != -1) { |
| 468 | if (HasInputFocus) { |
| 469 | // The submenu has focus, so call it's handler |
no test coverage detected