| 659 | } |
| 660 | |
| 661 | void 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 | |
| 678 | void PlayerInventory::setCustomBarSecondarySlot(CustomBarIndex customBarIndex, Maybe<InventorySlot> slot) { |
| 679 | auto& cbl = m_customBar.at(m_customBarGroup, customBarIndex); |
no test coverage detected