本文整理汇总了C++中CGameItemPtr::getStackBulk方法的典型用法代码示例。如果您正苦于以下问题:C++ CGameItemPtr::getStackBulk方法的具体用法?C++ CGameItemPtr::getStackBulk怎么用?C++ CGameItemPtr::getStackBulk使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGameItemPtr
的用法示例。
在下文中一共展示了CGameItemPtr::getStackBulk方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doInsertItem
// ****************************************************************************
CInventoryBase::TInventoryOpResult CRefInventory::doInsertItem(CGameItemPtr &item, uint32 slot, bool autoStack, bool ignoreWeightAndBulk)
{
nlassert(item != NULL);
nlassert(item->getRefInventory() == NULL);
nlassert(slot < _Items.size() || slot == INVENTORIES::INVALID_INVENTORY_SLOT);
if (!ignoreWeightAndBulk)
{
if (item->getStackWeight() + getInventoryWeight() > getMaxWeight())
return ior_overweight;
if (item->getStackBulk() + getInventoryBulk() > getMaxBulk())
return ior_overbulk;
}
// check that we still have a free slot
if (getFreeSlotCount() == 0)
return ior_no_free_slot;
if (slot == INVENTORIES::INSERT_IN_FIRST_FREE_SLOT)
slot = getFirstFreeSlot();
// remove any item referenced here
removeItem(slot);
// insert and link the new item
_Items[slot] = item;
item->setRefInventory(CInventoryPtr(this), slot);
updateWeightAndBulk(item, item->getStackSize());
--_FreeSlotCount;
// callbacks for derived class
onItemChanged(slot, INVENTORIES::itc_inserted);
// callback views
/*TViewCont::iterator first(_InventoryViews.begin()), last(_InventoryViews.end());
for (; first != last; ++first)
{
CInventoryViewPtr view = *first;
view->onItemChanged(slot, itc_inserted);
}*/
return ior_ok;
}