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

Method couldStack

source/game/StarItem.cpp:90–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88}
89
90uint64_t Item::couldStack(ItemConstPtr const& item) const {
91 if (stackableWith(item) && m_count < m_maxStack) {
92 uint64_t take = m_maxStack - m_count;
93 return std::min(take, item->count());
94 } else {
95 return 0;
96 }
97}
98
99bool Item::stackWith(ItemPtr const& item) {
100 uint64_t take = couldStack(item);

Callers 3

updateMethod · 0.80
InventoryPaneMethod · 0.80
ContainerPaneMethod · 0.80

Calls 1

countMethod · 0.45

Tested by

no test coverage detected