DayZ 1.27
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 строка 583

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