本文整理汇总了C++中cItem::CopyOne方法的典型用法代码示例。如果您正苦于以下问题:C++ cItem::CopyOne方法的具体用法?C++ cItem::CopyOne怎么用?C++ cItem::CopyOne使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cItem
的用法示例。
在下文中一共展示了cItem::CopyOne方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DistributeStack
void cSlotAreaArmor::DistributeStack(cItem & a_ItemStack, cPlayer & a_Player, bool a_ShouldApply, bool a_KeepEmptySlots)
{
if (ItemCategory::IsHelmet(a_ItemStack.m_ItemType) && GetSlot(0, a_Player)->IsEmpty())
{
if (a_ShouldApply)
{
SetSlot(0, a_Player, a_ItemStack.CopyOne());
}
a_ItemStack.m_ItemCount -= 1;
}
else if (ItemCategory::IsChestPlate(a_ItemStack.m_ItemType) && GetSlot(1, a_Player)->IsEmpty())
{
if (a_ShouldApply)
{
SetSlot(1, a_Player, a_ItemStack.CopyOne());
}
a_ItemStack.m_ItemCount -= 1;
}
else if (ItemCategory::IsLeggings(a_ItemStack.m_ItemType) && GetSlot(2, a_Player)->IsEmpty())
{
if (a_ShouldApply)
{
SetSlot(2, a_Player, a_ItemStack.CopyOne());
}
a_ItemStack.m_ItemCount -= 1;
}
else if (ItemCategory::IsBoots(a_ItemStack.m_ItemType) && GetSlot(3, a_Player)->IsEmpty())
{
if (a_ShouldApply)
{
SetSlot(3, a_Player, a_ItemStack.CopyOne());
}
a_ItemStack.m_ItemCount -= 1;
}
}
示例2: MoveItemsFromSlot
/// Moves one of the specified itemstack into this hopper. Returns true if contents have changed. Doesn't change the itemstack.
bool cHopperEntity::MoveItemsFromSlot(const cItem & a_ItemStack, bool a_AllowNewStacks)
{
cItem One(a_ItemStack.CopyOne());
if (m_Contents.AddItem(One, a_AllowNewStacks) > 0)
{
return true;
}
return false;
}
示例3: DistributeStack
void cSlotAreaEnchanting::DistributeStack(cItem & a_ItemStack, cPlayer & a_Player, bool a_Apply, bool a_KeepEmptySlots)
{
const cItem * Slot = GetSlot(0, a_Player);
if (!Slot->IsEmpty())
{
return;
}
if (a_Apply)
{
SetSlot(0, a_Player, a_ItemStack.CopyOne());
}
a_ItemStack.m_ItemCount -= 1;
if (a_ItemStack.m_ItemCount <= 0)
{
a_ItemStack.Empty();
}
UpdateResult(a_Player);
}