当前位置: 首页>>代码示例>>C++>>正文


C++ cItems::push_back方法代码示例

本文整理汇总了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());
		}
	}
}
开发者ID:4264,项目名称:cuberite,代码行数:35,代码来源:Monster.cpp

示例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));
	}
}
开发者ID:Kortak,项目名称:MCServer,代码行数:7,代码来源:ItemFrame.cpp

示例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));
	}
}
开发者ID:1285done,项目名称:cuberite,代码行数:7,代码来源:Painting.cpp

示例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));
	}
}
开发者ID:JoeClacks,项目名称:MCServer,代码行数:7,代码来源:Sheep.cpp

示例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());
	}
}
开发者ID:axisd,项目名称:MCServer,代码行数:8,代码来源:Monster.cpp

示例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));
	}
}
开发者ID:4264,项目名称:cuberite,代码行数:9,代码来源:Monster.cpp

示例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));
	}
}
开发者ID:4264,项目名称:cuberite,代码行数:9,代码来源:Monster.cpp

示例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));
	}
}
开发者ID:rhamilton1415,项目名称:cuberite,代码行数:9,代码来源:Monster.cpp

示例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));
	}
}
开发者ID:rhamilton1415,项目名称:cuberite,代码行数:10,代码来源:Monster.cpp

示例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[]
}
开发者ID:JoeClacks,项目名称:MCServer,代码行数:10,代码来源:ItemGrid.cpp

示例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));
	}
}
开发者ID:4264,项目名称:cuberite,代码行数:10,代码来源:Monster.cpp

示例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[]
}
开发者ID:Solexid,项目名称:MCServer,代码行数:21,代码来源:Window.cpp

示例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));
	}
}
开发者ID:DjKiDD,项目名称:MCServer,代码行数:13,代码来源:Horse.cpp

示例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);
	}
}
开发者ID:changyongGuo,项目名称:cuberite,代码行数:22,代码来源:Horse.cpp

示例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));
	}
}
开发者ID:ChriPiv,项目名称:MCServer,代码行数:13,代码来源:Pig.cpp


注:本文中的cItems::push_back方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。