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


C++ Inventory::setCapacity方法代码示例

本文整理汇总了C++中Inventory::setCapacity方法的典型用法代码示例。如果您正苦于以下问题:C++ Inventory::setCapacity方法的具体用法?C++ Inventory::setCapacity怎么用?C++ Inventory::setCapacity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Inventory的用法示例。


在下文中一共展示了Inventory::setCapacity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: _createInventory

Inventory* InventoryFactory::_createInventory(DatabaseResult* result)
{
	Inventory*	inventory = new Inventory();

	uint64 count = result->getRowCount();

	// get our results
	result->GetNextRow(mInventoryBinding,(void*)inventory);
	inventory->setParentId(inventory->mId - 1);

	inventory->setCapacity(inventory->mMaxSlots);
	return inventory;
}
开发者ID:Arnold47525,项目名称:mmoserver,代码行数:13,代码来源:InventoryFactory.cpp

示例2: createNonPersistentNpc

NPCObject* NonPersistentNpcFactory::createNonPersistentNpc(DatabaseResult* result, uint64 templateId, uint64 npcNewId, uint32 familyId, uint64 controllingObject)
{
	NPCObject*		npc;

	switch(familyId)
	{
		case NpcFamily_Trainer:
		{
			npc	= new Trainer();
		}
		break;		

		case NpcFamily_Filler:
		{
			npc	= new FillerNPC();
		}
		break;

		case NpcFamily_QuestGiver:
		{
			npc	= new QuestGiver();
		}
		break;

		case NpcFamily_AttackableObject:
		{
			// Stuff like Debris.
			npc	= new AttackableStaticNpc();
		}
		break;

		case NpcFamily_AttackableCreatures:
		{
			// gLogger->logMsgF("NonPersistentNpcFactory::_createNonPersistentNpc() Created a NpcFamily_AttackableCreatures", MSG_NORMAL);
			// Stuff like npc's and womp rats :).
			npc	= new AttackableCreature(templateId);
		}
		break;

		case NpcFamily_NaturalLairs:
		{
			// First time lairs.
			// gLogger->logMsgF("NonPersistentNpcFactory::createNonPersistentNpc() Created a NpcFamily_NaturalLairs", MSG_NORMAL);

			//Lairs are not supported here, at least not yet.
			assert(false && "NonPersistentNpcFactory::createNonPersistent NpcFamily_NaturalLairs Lairs are not supported here yet.");
			npc	= new LairObject(templateId);
		}
		break;

		default:
		{
			gLogger->logMsgF("NonPersistentNpcFactory::createNonPersistent unknown Family %u",MSG_HIGH,familyId);
			assert(false && "NonPersistentNpcFactory::createNonPersistent unknown family");
			npc = new NPCObject();
		}
		break;
	}

	// Set the new temporarily id.
	npc->setId(npcNewId);

	// Register object with WorldManager.
	gWorldManager->addObject(npc, true);

	Inventory*	npcInventory = new Inventory();
	npcInventory->setCapacity(50);//we want to be able to fill something in our inventory
	npcInventory->setParent(npc);

	uint64 count = result->getRowCount();

	result->GetNextRow(mNonPersistentNpcBinding,(void*)npc);

	// The template for this creature, in case of a respawn.
	npc->mNpcTemplateId = templateId;

	// Should bet fetched from attributes, these will do as defaults.
	npc->mHam.mHealth.setCurrentHitPoints(500);
	npc->mHam.mAction.setCurrentHitPoints(500);
	npc->mHam.mMind.setCurrentHitPoints(500);
	npc->mHam.calcAllModifiedHitPoints();

	// inventory
	npcInventory->setId(npc->mId + 1);
	npcInventory->setParentId(npc->mId);
	npcInventory->setModelString("object/tangible/inventory/shared_creature_inventory.iff");
	
	npcInventory->setName("inventory");
	npcInventory->setNameFile("item_n");
	npcInventory->setTangibleGroup(TanGroup_Inventory);
	npcInventory->setTangibleType(TanType_CreatureInventory);
	npc->mEquipManager.addEquippedObject(CreatureEquipSlot_Inventory,npcInventory);

	if (npc->getNpcFamily() == NpcFamily_AttackableObject)
	{
		// Dynamic spawned pve-enabled "static" creatures like debris.
		npc->setType(ObjType_Creature);
		npc->setCreoGroup(CreoGroup_AttackableObject);

		npc->mTypeOptions = 0x0;
//.........这里部分代码省略.........
开发者ID:Arnold47525,项目名称:mmoserver,代码行数:101,代码来源:NonPersistentNpcFactory.cpp


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