about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-11-04 10:29:54 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-11-04 10:29:54 -0800
commitbc6fcd0fcb56df5e12ace096a66d56badb97cdfc (patch)
tree41f013754be9537e73a1271892d90f256440e354
parent96369323aac71aeadd90432426b3e6709430aa2d (diff)
downloadmu-bc6fcd0fcb56df5e12ace096a66d56badb97cdfc.tar.gz
2350
Now it's not just tests that define recipe variants.
-rw-r--r--057static_dispatch.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/057static_dispatch.cc b/057static_dispatch.cc
index 35a703bf..3a19714a 100644
--- a/057static_dispatch.cc
+++ b/057static_dispatch.cc
@@ -20,7 +20,12 @@ recipe test a:number, b:number -> z:number [
 :(before "End Globals")
 map<string, vector<recipe_ordinal> > Recipe_variants;
 :(before "End Setup")
-Recipe_variants.clear();
+for (map<string, vector<recipe_ordinal> >::iterator p = Recipe_variants.begin(); p != Recipe_variants.end(); ++p) {
+  for (long long int i = 0; i < SIZE(p->second); ++i) {
+    if (p->second.at(i) >= Reserved_for_tests)
+      p->second.at(i) = -1;
+  }
+}
 
 :(before "End Load Recipe Header(result)")
 if (Recipe_ordinal.find(result.name) != Recipe_ordinal.end()) {
@@ -128,6 +133,7 @@ void replace_best_variant(instruction& inst) {
 }
 
 long long int variant_score(const instruction& inst, recipe_ordinal variant) {
+  if (variant == -1) return -1;
   const vector<reagent>& header_ingredients = Recipe[variant].ingredients;
   if (SIZE(inst.ingredients) < SIZE(header_ingredients)) {
     trace(9993, "transform") << "too few ingredients" << end();