コード例 #1
0
ファイル: SavedGame.cpp プロジェクト: ben0x539/OpenXcom
/**
   Get the list of RuleManufactureInfo which can be manufacture in a Base.
   * @param productions the list of Productions which are available.
   * @param ruleset the Game Ruleset
   * @param base a pointer to a Base
*/
void SavedGame::getAvailableProductions (std::vector<RuleManufactureInfo *> & productions, Ruleset * ruleset, Base * base) const
{
	const std::vector<const RuleResearchProject *> & discovereds(getDiscoveredResearchs());
	const std::map<std::string, RuleManufactureInfo *> & items (ruleset->getManufactureProjects ());
	const std::vector<Production *> baseProductions (base->getProductions ());

	for(std::map<std::string, RuleManufactureInfo *>::const_iterator iter = items.begin ();
	    iter != items.end ();
	    ++iter)
	{
		if(std::find(discovereds.begin (), discovereds.end (), ruleset->getResearchProject(iter->first)) == discovereds.end ())
		{
		 	continue;
		}
		if(std::find_if(baseProductions.begin (), baseProductions.end (), equalProduction(iter->second)) != baseProductions.end ())
		{
			continue;
		}
		productions.push_back(iter->second);
	}
}
コード例 #2
0
/**
   Get the list of RuleManufacture which can be manufacture in a Base.
   * @param productions the list of Productions which are available.
   * @param ruleset the Game Ruleset
   * @param base a pointer to a Base
*/
void SavedGame::getAvailableProductions (std::vector<RuleManufacture *> & productions, Ruleset * ruleset, Base * base) const
{
	const std::vector<std::string> items (ruleset->getManufactureList ());
	const std::vector<Production *> baseProductions (base->getProductions ());

	for(std::vector<std::string>::const_iterator iter = items.begin ();
		iter != items.end ();
		++iter)
	{
		RuleManufacture *m = ruleset->getManufacture(*iter);
		if(!isResearched(m->getRequirements()))
		{
		 	continue;
		}
		if(std::find_if(baseProductions.begin (), baseProductions.end (), equalProduction(m)) != baseProductions.end ())
		{
			continue;
		}
		productions.push_back(m);
	}
}