本文整理汇总了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;
}
示例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;
}
示例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 §ion, ArticleDefinitionList &data)
{
ArticleDefinitionList::iterator it;
for (it=_visible_articles.begin(); it!=_visible_articles.end(); ++it)
{
if ((*it)->section == section)
{
data.push_back(*it);
}
}
}