本文整理汇总了C++中mwworld::ContainerStoreIterator::getContainerStore方法的典型用法代码示例。如果您正苦于以下问题:C++ ContainerStoreIterator::getContainerStore方法的具体用法?C++ ContainerStoreIterator::getContainerStore怎么用?C++ ContainerStoreIterator::getContainerStore使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mwworld::ContainerStoreIterator
的用法示例。
在下文中一共展示了ContainerStoreIterator::getContainerStore方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
void ContainerItemModel::update()
{
mItems.clear();
for (std::vector<MWWorld::Ptr>::iterator source = mItemSources.begin(); source != mItemSources.end(); ++source)
{
MWWorld::ContainerStore& store = MWWorld::Class::get(*source).getContainerStore(*source);
for (MWWorld::ContainerStoreIterator it = store.begin(); it != store.end(); ++it)
{
std::vector<ItemStack>::iterator itemStack = mItems.begin();
for (; itemStack != mItems.end(); ++itemStack)
{
// If one of the items is in an inventory and currently equipped, we need to check stacking both ways to be sure
if (store.stacks(itemStack->mBase, *it) && it->getContainerStore()->stacks(itemStack->mBase, *it))
{
// we already have an item stack of this kind, add to it
itemStack->mCount += it->getRefData().getCount();
break;
}
}
if (itemStack == mItems.end())
{
// no stack yet, create one
ItemStack newItem (*it, this, it->getRefData().getCount());
mItems.push_back(newItem);
}
}
}
}