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


C++ ArticleDefinitionList类代码示例

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


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

示例1: getAvailableArticles

	/**
	 * Gets the index of the selected article_id in the visible list.
	 * If the id is not found, returns -1.
	 * @param save Pointer to saved game.
	 * @param rule Pointer to ruleset.
	 * @param article_id Article id to find.
	 * @returns Index of the given article id in the internal list, -1 if not found.
	 */
	size_t Ufopaedia::getArticleIndex(SavedGame *save, Ruleset *rule, std::string &article_id)
	{
		std::string UC_ID = article_id + "_UC";
		ArticleDefinitionList articles = getAvailableArticles(save, rule);
		for (size_t it=0; it<articles.size(); ++it)
		{
			for (std::vector<std::string>::iterator j = articles[it]->requires.begin(); j != articles[it]->requires.end(); ++j)
			{
				if (article_id == *j)
				{
					article_id = articles[it]->id;
					return it;
				}
			}
			if (articles[it]->id == article_id)
			{
				return it;
			}
			if (articles[it]->id == UC_ID)
			{
				article_id = UC_ID;
				return it;
			}
		}
		return -1;
	}
开发者ID:vazub,项目名称:OpenXcom,代码行数:34,代码来源:Ufopaedia.cpp

示例2: getAvailableArticles

	/**
	 * Gets the index of the selected article_id in the visible list.
	 * If the id is not found, returns -1.
	 * @param article_id Article id to find.
	 * @returns Index of the given article id in the internal list, -1 if not found.
	 */
	size_t Ufopaedia::getArticleIndex(Game *game, const std::string &article_id)
	{
		ArticleDefinitionList articles = getAvailableArticles(game);
		for (size_t it=0; it<articles.size(); ++it)
		{
			if (articles[it]->id == article_id)
			{
				return it;
			}
		}
		return -1;
	}
开发者ID:DiegoVazquezNanini,项目名称:OpenXcom,代码行数:18,代码来源:Ufopaedia.cpp

示例3: getSectionList

	/**
	 * Fill an ArticleList with the currently visible ArticleIds of the given section.
	 * @param section Article section to find, e.g. "XCOM Crafts & Armaments", "Alien Lifeforms", etc.
	 * @param data Article definition list object to fill data in.
	 */
	void UfopaediaSaved::getSectionList(const std::string &section, ArticleDefinitionList &data)
	{
		ArticleDefinitionList::iterator it;

		for (it=_visible_articles.begin(); it!=_visible_articles.end(); ++it)
		{
			if ((*it)->section == section)
			{
				data.push_back(*it);
			}
		}
	}
开发者ID:Devanon,项目名称:OpenXcom,代码行数:17,代码来源:UfopaediaSaved.cpp


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