diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-09-27 10:28:14 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-09-27 10:28:14 -0700 |
commit | 048a33c24fe4b1e937391693e3556e1edfdbfbcd (patch) | |
tree | 2bf1f6034171283d1f01123d79a9deeef5949647 /056shape_shifting_recipe.cc | |
parent | a91e183799b5ba41455c79e648ff4397a27838c4 (diff) | |
download | mu-048a33c24fe4b1e937391693e3556e1edfdbfbcd.tar.gz |
3422
Stop checking the number of ingredients and products when picking shape-shifting recipes. That's more consistent with how we handle regular recipes, and we still get errors in all the examples I can think of: reverse # no ingredients or products n:num <- length # no ingredients; products don't provide type
Diffstat (limited to '056shape_shifting_recipe.cc')
-rw-r--r-- | 056shape_shifting_recipe.cc | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/056shape_shifting_recipe.cc b/056shape_shifting_recipe.cc index 49b6fcdf..a389bd65 100644 --- a/056shape_shifting_recipe.cc +++ b/056shape_shifting_recipe.cc @@ -109,21 +109,13 @@ vector<recipe_ordinal> strictly_matching_shape_shifting_variants(const instructi } 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(); |