From 6c69569a4c4ca3a23635d4d7a40f0fe557194619 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Wed, 28 Sep 2016 20:08:04 -0700 Subject: 3430 --- html/056shape_shifting_recipe.cc.html | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'html/056shape_shifting_recipe.cc.html') diff --git a/html/056shape_shifting_recipe.cc.html b/html/056shape_shifting_recipe.cc.html index 2b120069..4bfbafc1 100644 --- a/html/056shape_shifting_recipe.cc.html +++ b/html/056shape_shifting_recipe.cc.html @@ -146,21 +146,13 @@ vector<recipe_ordinal> strictly_matching_shape_shifting_variants} bool all_concrete_header_reagents_strictly_match(const instruction& inst, const recipe& variant) { - if (SIZE(inst.ingredients) < SIZE(variant.ingredients)) { - trace(9993, "transform") << "too few ingredients" << end(); - return false; - } - if (SIZE(variant.products) < SIZE(inst.products)) { - trace(9993, "transform") << "too few products" << end(); - return false; - } - for (int i = 0; i < SIZE(variant.ingredients); ++i) { + for (int i = 0; i < min(SIZE(inst.ingredients), SIZE(variant.ingredients)); ++i) { if (!concrete_type_names_strictly_match(variant.ingredients.at(i), inst.ingredients.at(i))) { trace(9993, "transform") << "concrete-type match failed: ingredient " << i << end(); return false; } } - for (int i = 0; i < SIZE(inst.products); ++i) { + for (int i = 0; i < min(SIZE(inst.products), SIZE(variant.ingredients)); ++i) { if (is_dummy(inst.products.at(i))) continue; if (!concrete_type_names_strictly_match(variant.products.at(i), inst.products.at(i))) { trace(9993, "transform") << "strict match failed: product " << i << end(); @@ -359,10 +351,6 @@ recipe_ordinal new_variant(recipe_ordinal exempla } } -int min(int a, int b) { - return (a < b) ? a : b; -} - void accumulate_type_ingredients(const reagent& exemplar_reagent, reagent& refinement, map<string, const type_tree*>& mappings, const recipe& exemplar, const instruction& call_instruction, const recipe& caller_recipe, bool* error) { assert(refinement.type); accumulate_type_ingredients(exemplar_reagent.type, refinement.type, mappings, exemplar, exemplar_reagent, call_instruction, caller_recipe, error); -- cgit 1.4.1-2-gfad0