DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ GetRecipeIntersection()

int PluginRecipesManagerBase::GetRecipeIntersection ( int num_of_ingredients,
ItemBase items[] )
inlineprotected

fills an array with recipe IDs which 'item_a' and 'item_b' share

См. определение в файле PluginRecipesManager.c строка 590

591 {
592 int count = 0;
593 int smallest = 9999;
594 int smallest_index = 0;
595 m_RecipesMatched.Clear();
596
597 /*
598 m_Ingredients[0] = item_a;
599 m_Ingredients[1] = item_b;
600 */
601 //find the item with smallest number of recipes
602 CacheObject co_least_recipes;
603
604 for (int i = 0; i < num_of_ingredients; i++)
605 {
606 CacheObject cobject = PluginRecipesManager.m_RecipeCache.Get( items[i].GetType() );
607 if (!cobject)
608 {
609 return 0;
610 }
611 if (cobject.GetNumberOfRecipes() < smallest)
612 {
613 smallest = cobject.GetNumberOfRecipes();
614 smallest_index = i;
615 co_least_recipes = cobject;
616 }
617 }
618
619 //look for matches
620 array<int> recipes = co_least_recipes.GetRecipes();
621 for (int x = 0; x < recipes.Count(); x++)
622 {
623 int id = recipes.Get(x);
624 for (int z = 0; z < num_of_ingredients; z++)
625 {
626 if ( z!= smallest_index)
627 {
628 CacheObject cobject2 = PluginRecipesManager.m_RecipeCache.Get( items[z].GetType() );
629 if ( cobject2.IsContainRecipe(id) )
630 {
631 m_RecipesMatched.Insert(id);
632 count++;
633 }
634 }
635 }
636 }
637 return count;
638 }
eBleedingSourceType GetType()
void CacheObject()
Определения CacheObject.c:35
Icon x
void PluginRecipesManager()
Определения PluginRecipesManager.c:52
ref array< int > m_RecipesMatched
Определения PluginRecipesManager.c:39

Перекрестные ссылки CacheObject(), GetType(), m_RecipesMatched, PluginRecipesManager() и x.

Используется в GetValidRecipesProper().