本文整理汇总了C++中cItems::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ cItems::push_back方法的具体用法?C++ cItems::push_back怎么用?C++ cItems::push_back使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cItems
的用法示例。
在下文中一共展示了cItems::push_back方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddRandomArmorDropItem
void cMonster::AddRandomArmorDropItem(cItems & a_Drops, unsigned int a_LootingLevel)
{
MTRand r1;
if (r1.randInt() % 200 < ((m_DropChanceHelmet * 200) + (a_LootingLevel * 2)))
{
if (!GetEquippedHelmet().IsEmpty())
{
a_Drops.push_back(GetEquippedHelmet());
}
}
if (r1.randInt() % 200 < ((m_DropChanceChestplate * 200) + (a_LootingLevel * 2)))
{
if (!GetEquippedChestplate().IsEmpty())
{
a_Drops.push_back(GetEquippedChestplate());
}
}
if (r1.randInt() % 200 < ((m_DropChanceLeggings * 200) + (a_LootingLevel * 2)))
{
if (!GetEquippedLeggings().IsEmpty())
{
a_Drops.push_back(GetEquippedLeggings());
}
}
if (r1.randInt() % 200 < ((m_DropChanceBoots * 200) + (a_LootingLevel * 2)))
{
if (!GetEquippedBoots().IsEmpty())
{
a_Drops.push_back(GetEquippedBoots());
}
}
}
示例2: GetDrops
void cItemFrame::GetDrops(cItems & a_Items, cEntity * a_Killer)
{
if ((a_Killer != NULL) && a_Killer->IsPlayer() && !((cPlayer *)a_Killer)->IsGameModeCreative())
{
a_Items.push_back(cItem(E_ITEM_ITEM_FRAME));
}
}
示例3: GetDrops
void cPainting::GetDrops(cItems & a_Items, cEntity * a_Killer)
{
if ((a_Killer != nullptr) && a_Killer->IsPlayer() && !static_cast<cPlayer *>(a_Killer)->IsGameModeCreative())
{
a_Items.push_back(cItem(E_ITEM_PAINTING));
}
}
示例4: GetDrops
void cSheep::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
if (!m_IsSheared)
{
a_Drops.push_back(cItem(E_BLOCK_WOOL, 1, m_WoolColor));
}
}
示例5: AddRandomWeaponDropItem
void cMonster::AddRandomWeaponDropItem(cItems & a_Drops, short a_LootingLevel)
{
MTRand r1;
if (r1.randInt() % 200 < ((m_DropChanceWeapon * 200) + (a_LootingLevel * 2)))
{
if (!GetEquippedWeapon().IsEmpty()) a_Drops.push_back(GetEquippedWeapon());
}
}
示例6: AddRandomDropItem
void cMonster::AddRandomDropItem(cItems & a_Drops, unsigned int a_Min, unsigned int a_Max, short a_Item, short a_ItemHealth)
{
MTRand r1;
int Count = r1.randInt() % (a_Max + 1 - a_Min) + a_Min;
if (Count > 0)
{
a_Drops.push_back(cItem(a_Item, Count, a_ItemHealth));
}
}
示例7: AddRandomUncommonDropItem
void cMonster::AddRandomUncommonDropItem(cItems & a_Drops, float a_Chance, short a_Item, short a_ItemHealth)
{
MTRand r1;
int Count = r1.randInt() % 1000;
if (Count < (a_Chance * 10))
{
a_Drops.push_back(cItem(a_Item, 1, a_ItemHealth));
}
}
示例8: AddRandomDropItem
void cMonster::AddRandomDropItem(cItems & a_Drops, unsigned int a_Min, unsigned int a_Max, short a_Item, short a_ItemHealth)
{
MTRand r1;
int Count = static_cast<int>(static_cast<unsigned int>(r1.randInt()) % (a_Max + 1 - a_Min) + a_Min);
if (Count > 0)
{
a_Drops.push_back(cItem(a_Item, static_cast<char>(Count), a_ItemHealth));
}
}
示例9: AddRandomRareDropItem
void cMonster::AddRandomRareDropItem(cItems & a_Drops, cItems & a_Items, unsigned int a_LootingLevel)
{
MTRand r1;
unsigned int Count = static_cast<unsigned int>(static_cast<unsigned long>(r1.randInt()) % 200);
if (Count < (5 + a_LootingLevel))
{
size_t Rare = static_cast<size_t>(r1.randInt()) % a_Items.Size();
a_Drops.push_back(a_Items.at(Rare));
}
}
示例10: CopyToItems
void cItemGrid::CopyToItems(cItems & a_Items) const
{
for (int i = 0; i < m_NumSlots; i++)
{
if (!m_Slots[i].IsEmpty())
{
a_Items.push_back(m_Slots[i]);
}
} // for i - m_Slots[]
}
示例11: AddRandomRareDropItem
void cMonster::AddRandomRareDropItem(cItems & a_Drops, cItems & a_Items, unsigned int a_LootingLevel)
{
MTRand r1;
unsigned int Count = r1.randInt() % 200;
if (Count < (5 + a_LootingLevel))
{
int Rare = r1.randInt() % a_Items.Size();
a_Drops.push_back(a_Items.at(Rare));
}
}
示例12: GetSlots
void cWindow::GetSlots(cPlayer & a_Player, cItems & a_Slots) const
{
a_Slots.clear();
a_Slots.reserve(GetNumSlots());
for (cSlotAreas::const_iterator itr = m_SlotAreas.begin(), end = m_SlotAreas.end(); itr != end; ++itr)
{
int NumSlots = (*itr)->GetNumSlots();
for (int i = 0; i < NumSlots; i++)
{
const cItem * Item = (*itr)->GetSlot(i, a_Player);
if (Item == NULL)
{
a_Slots.push_back(cItem());
}
else
{
a_Slots.push_back(*Item);
}
}
} // for itr - m_SlotAreas[]
}
示例13: GetDrops
void cHorse::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
int LootingLevel = 0;
if (a_Killer != nullptr)
{
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
}
AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_LEATHER);
if (m_bIsSaddled)
{
a_Drops.push_back(cItem(E_ITEM_SADDLE, 1));
}
}
示例14: GetDrops
void cHorse::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
if (IsBaby())
{
return; // Babies don't drop items
}
unsigned int LootingLevel = 0;
if (a_Killer != nullptr)
{
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
}
AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_LEATHER);
if (IsSaddled())
{
a_Drops.push_back(m_Saddle);
}
if (!m_Armor.IsEmpty())
{
a_Drops.push_back(m_Armor);
}
}
示例15: GetDrops
void cPig::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
int LootingLevel = 0;
if (a_Killer != NULL)
{
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
}
AddRandomDropItem(a_Drops, 1, 3 + LootingLevel, IsOnFire() ? E_ITEM_COOKED_PORKCHOP : E_ITEM_RAW_PORKCHOP);
if (m_bIsSaddled)
{
a_Drops.push_back(cItem(E_ITEM_SADDLE, 1));
}
}