MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / Execute

Method Execute

netgames/dmfc/dmfcmenu.cpp:412–491  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

410 return false;
411}
412void 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

Callers 2

OnKeypressMethod · 0.80

Calls 3

CallFuncMethod · 0.80
CheckPlayerNumMethod · 0.80
GetTypeMethod · 0.45

Tested by

no test coverage detected