MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / setCustomBarPrimarySlot

Method setCustomBarPrimarySlot

source/game/StarPlayerInventory.cpp:661–676  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

659}
660
661void PlayerInventory::setCustomBarPrimarySlot(CustomBarIndex customBarIndex, Maybe<InventorySlot> slot) {
662 // The primary slot is not allowed to point to an empty item.
663 if (slot) {
664 if (!itemsAt(*slot))
665 slot = {};
666 }
667
668 auto& cbl = m_customBar.at(m_customBarGroup, customBarIndex);
669 if (slot && cbl.second == slot) {
670 // If we match the secondary slot, just swap the slots for primary and
671 // secondary
672 swap(cbl.first, cbl.second);
673 } else {
674 cbl.first = slot;
675 }
676}
677
678void PlayerInventory::setCustomBarSecondarySlot(CustomBarIndex customBarIndex, Maybe<InventorySlot> slot) {
679 auto& cbl = m_customBar.at(m_customBarGroup, customBarIndex);

Callers 3

makePlayerCallbacksMethod · 0.80
customBarClickMethod · 0.80
customBarClickRightMethod · 0.80

Calls 1

atMethod · 0.45

Tested by

no test coverage detected