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


C++ CEntity::SetCategory方法代码示例

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


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

示例1: CreateEntityByCategory

//Create an entity from its category name. The category name is looked
//up in the EntityCats.hrd file to check what properties must be attached
//to the entity. All required properties will be attached, and all
//attributes will be initialised in their default state.
//!!!!!tmp not const!
CEntity* CEntityFactory::CreateEntityByCategory(CStrID GUID, CStrID Category, EntityPool EntPool) //const
{
	int Idx = Categories.FindIndex(Category);
	if (Idx != INVALID_INDEX)
	{
		const CEntityCat& Cat = Categories.ValueAtIndex(Idx);
		n_assert(Cat.InstDataset.isvalid());
		
		CEntity* pEntity = CreateEntityByClassName(Cat.CppClass);
		pEntity->SetLive(EntPool == LivePool);
		pEntity->SetAttrTable(Cat.InstDataset->GetValueTable());
		pEntity->SetAttrTableRowIndex(Cat.InstDataset->GetValueTable()->AddRow());
		pEntity->SetCategory(Category);
		pEntity->SetUniqueID(GUID);

		for (int i = 0; i < Cat.Properties.Size(); i++)
			AttachProperty(*pEntity, Cat.Properties[i]);

		return pEntity;
	}
	else
	{
		n_error("Loading::CEntityFactory::CreateEntityByCategory(%s): category not found in EntityCats.hrd!",
		Category.CStr());
		return NULL;
	}
}
开发者ID:moltenguy1,项目名称:deusexmachina,代码行数:32,代码来源:EntityFactory.cpp

示例2: CreateTmpEntity

CEntity* CEntityFactory::CreateTmpEntity(CStrID GUID, CStrID Category, PValueTable Table, int Row) const
{
	CEntity* pEntity = CreateEntityByClassName("Entity");
	pEntity->SetCategory(Category); //???add to dummy table all attrs if category exists?
	pEntity->SetAttrTable(Table);
	pEntity->SetAttrTableRowIndex(Row);
	pEntity->SetUniqueID(GUID);
	pEntity->SetLive(true);
	return pEntity;
}
开发者ID:moltenguy1,项目名称:deusexmachina,代码行数:10,代码来源:EntityFactory.cpp

示例3: CreateEntityByTemplate

CEntity* CEntityFactory::CreateEntityByTemplate(CStrID GUID, CStrID Category, CStrID TplName, EntityPool EntPool)
{
	n_assert(Category.IsValid());
	n_assert(TplName.IsValid());

	const CEntityCat& Cat = Categories[Category];
	
	int TplIdx = FindTemplate(TplName, Cat);
	if (TplIdx == INVALID_INDEX) return NULL;

	CEntity* pEntity = CreateEntityByClassName(Cat.CppClass);
	pEntity->SetLive(EntPool == LivePool);
	pEntity->SetAttrTable(Cat.InstDataset->GetValueTable());
	pEntity->SetAttrTableRowIndex(Cat.InstDataset->GetValueTable()->CopyExtRow(Cat.TplDataset->GetValueTable(), TplIdx, true));
	pEntity->SetCategory(Category);
	pEntity->SetUniqueID(GUID);

	for (int i = 0; i < Cat.Properties.Size(); i++)
		AttachProperty(*pEntity, Cat.Properties[i]);

	return pEntity;
}
开发者ID:moltenguy1,项目名称:deusexmachina,代码行数:22,代码来源:EntityFactory.cpp


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