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


C++ Link::GetSecondary方法代码示例

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


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

示例1: Update

	void Update(float aStep)
	{
		// was used?
		bool wasUsed = false;

		// get team affiliation
		unsigned int aHitTeam = Database::team.Get(mHitId);

		if (Database::pickuplink.Find(mId))
			Database::Deactivate(mHitId);

		// for each pickup link...
#ifdef PICKUP_CASCADE_LINK_CHAIN
		const Database::Typed<Link *> &links = Database::link.Get(mHitId);
#endif
		for (Database::Typed<LinkTemplate>::Iterator itor(Database::pickuplink.Get(mId).Find(aHitTeam)); itor.IsValid(); ++itor)
		{
			// if the recipient supports the link...
			if (Database::linktemplate.Get(mHitId).Find(itor.GetKey()))
			{
				// open link templates for the hit entity
				Database::Typed<LinkTemplate> &linktemplates = Database::linktemplate.Open(mHitId);

#ifdef PICKUP_CASCADE_LINK_CHAIN
				// cascade along link chain
				bool chain = true;
				for (unsigned int name = itor.GetKey(); name != 0; name = linktemplates.Get(name).mNext)
				{
					// get the link template
					LinkTemplate &linktemplate = linktemplates.Open(name);

					// save previous contents
					unsigned int prev = linktemplate.mSecondary;

					// get the link group
					unsigned int group = linktemplate.mGroup;
					bool groupempty = true;

					// get the corresponding link
					if (Link *link = links.Get(name))
					{
						// if the link is empty...
						if (!Database::entity.Find(link->GetSecondary()))
						{
							// clear value
							prev = 0U;
						}
					}

					// for each link...
					for (Database::Typed<Link *>::Iterator itor2(&links); itor2.IsValid(); ++itor2)
					{
						// if the link is not empty...
						Link *link = itor2.GetValue();
						if (Database::entity.Find(link->GetSecondary()))
						{
							// group is not empty
							if (groupempty && linktemplates.Get(itor2.GetKey()).mGroup == group)
							{
								groupempty = false;
							}
						}
					}

					// set link template based on chaining
					linktemplate.mSecondary = chain ? link : prev;
					DebugPrint("%s link %08x: %s -> %s\n", Database::name.Get(mHitId).c_str(), name, Database::name.Get(prev).c_str(), Database::name.Get(link).c_str());

					// if the group is empty
					if (groupempty)
					{
						// stop chaining
						chain = false;
					}
					else
					{
						// push link template contents forward
						link = prev;
					}

					// close link template
					linktemplates.Close(name);
				}
#else
				// link name
				unsigned int name = itor.GetKey();

				// get baseline version
				unsigned int parent = Database::parent.Get(mHitId);
				const LinkTemplate &linktemplatebase = Database::linktemplate.Get(parent).Get(name);

				// merge templates (HACK)
				// TO DO: figure out how to determine template overrides
				const LinkTemplate &link = itor.GetValue();
				LinkTemplate merge(linktemplatebase);
				merge.mSecondary = link.mSecondary;
				merge.mOffset = link.mOffset * linktemplatebase.mOffset;

				// set link template based on link
				DebugPrint("%s link %08x: %s -> %s\n", Database::name.Get(mHitId).c_str(), name, Database::name.Get(linktemplates.Get(name).mSecondary).c_str(), Database::name.Get(link.mSecondary).c_str());
//.........这里部分代码省略.........
开发者ID:Fissuras,项目名称:videoventure,代码行数:101,代码来源:Pickup.cpp


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