MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / ShowCommand

Method ShowCommand

engine/Poseidon/UI/InGame/InGameUI.cpp:648–695  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

646 _parent->NotifySubmenuCommandRemoved(cmd);
647 }
648 if (cmd == _maxCmd || cmd == _minCmd)
649 {
650 // range may be descreased - something happening on the edge
651 RescanMinMax();
652 }
653}
654
655void Menu::RescanParents()
656{
657 Menu* parent = _parent;
658 while (parent)
659 {
660 parent->RescanMinMax();
661 if (parent->_atomic)
662 {
663 break;
664 }
665 parent = parent->_parent;
666 }
667}
668
669void Menu::RescanChildren()
670{
671 for (int i = 0; i < _items.Size(); i++)
672 {
673 MenuItem* item = _items[i];
674 if (item->_submenu)
675 {
676 item->_submenu->RescanChildren();
677 item->_submenu->RescanMinMax();
678 }
679 }
680}
681
682void Menu::RescanMinMax()
683{
684 // scan menu (and optionally all submenus)
685 int oldMin = _minCmd, oldMax = _maxCmd;
686 _minCmd = INT_MAX, _maxCmd = INT_MIN;
687 for (int i = 0; i < _items.Size(); i++)
688 {
689 MenuItem* item = _items[i];
690 if (item->_cmd >= 0)
691 {
692 saturateMax(_maxCmd, item->_cmd);
693 saturateMin(_minCmd, item->_cmd);
694 }
695 if (!_atomic && item->_submenu)
696 {
697 saturateMax(_maxCmd, item->_submenu->_maxCmd);
698 saturateMin(_minCmd, item->_submenu->_minCmd);

Callers 1

ProcessMenuMethod · 0.80

Calls 1

SizeMethod · 0.45

Tested by

no test coverage detected