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

Method InsertItem

core/MenuStyle_Base.cpp:647–666  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

645}
646
647bool CBaseMenu::InsertItem(unsigned int position, const char *info, const ItemDrawInfo &draw)
648{
649 if (m_Pagination == (unsigned)MENU_NO_PAGINATION &&
650 m_items.size() >= m_pStyle->GetMaxPageItems())
651 {
652 return false;
653 }
654
655 if (position >= m_items.size())
656 return false;
657
658 CItem item(position);
659 item.info = info;
660 if (draw.display)
661 item.display = std::make_unique<std::string>(draw.display);
662 item.style = draw.style;
663
664 m_items.emplace(m_items.begin() + position, std::move(item));
665 return true;
666}
667
668bool CBaseMenu::RemoveItem(unsigned int position)
669{

Callers 1

InsertMenuItemFunction · 0.80

Calls 3

sizeMethod · 0.45
GetMaxPageItemsMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected