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

◆ ResolveIngredients()

bool PluginRecipesManagerBase::ResolveIngredients ( int num_of_ingredients,
int passes = 0 )
inlineprotected

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

524 {
525 int rightmost_bit;
526 int smallest = 99999;
527 int smallest_index = 0;
528
529 for (int i = 0; i < num_of_ingredients; i++)
530 {
531 int count = m_IngredientBitMaskSize[i];
532 if ( count != 0 && count < smallest)
533 {
534 smallest = m_IngredientBitMaskSize[i];
535 smallest_index = i;
536 }
537 }
538
539 rightmost_bit = m_IngredientBitMask[smallest_index] & (-m_IngredientBitMask[smallest_index]);
540 m_BitsResults[smallest_index] = m_BitsResults[smallest_index] | rightmost_bit;
541
542 for (int x = 0; x < num_of_ingredients; x++)
543 {
544 m_IngredientBitMask[x] = ~rightmost_bit & m_IngredientBitMask[x];
545 m_IngredientBitMask[smallest_index] = 0;
546 m_IngredientBitMaskSize[smallest_index] = 0;
547 }
548
549 // check validity
550 int check_sum_vertical = 0;
551
552 for (int z = 0; z < num_of_ingredients; z++)
553 {
554 check_sum_vertical = check_sum_vertical | m_IngredientBitMask[z];//vertical sum
555 check_sum_vertical = check_sum_vertical | m_BitsResults[z];//vertical sum
556 if ((m_IngredientBitMask[z] | m_BitsResults[z]) == 0)
557 {
558 return false;//horizontal check
559 }
560 }
561
562 if ( check_sum_vertical != (Math.Pow(2, num_of_ingredients) - 1)) return false;//vertical check
563
564 passes++;
565
566 if (passes < num_of_ingredients)
567 {
568 if ( !ResolveIngredients(num_of_ingredients, passes) ) return false;
569 }
570 return true;
571 }
Icon x
int m_IngredientBitMaskSize[MAX_INGREDIENTS]
Определения PluginRecipesManager.c:29
bool ResolveIngredients(int num_of_ingredients, int passes=0)
Определения PluginRecipesManager.c:523
int m_BitsResults[MAX_INGREDIENTS]
Определения PluginRecipesManager.c:31
int m_IngredientBitMask[MAX_INGREDIENTS]
Определения PluginRecipesManager.c:28

Перекрестные ссылки m_BitsResults, m_IngredientBitMask, m_IngredientBitMaskSize, Math::Pow(), ResolveIngredients() и x.

Используется в ResolveIngredients() и SortIngredientsInRecipe().