about summary refs log tree commit diff stats
path: root/091run_interactive.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-11-19 23:44:11 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-11-19 23:47:15 -0800
commit9aacd50defdb4c6eb5d860a905af4d572cf7598a (patch)
treeda5bbbfeab5aeb91e2d2e9f8a565279f6dfe3eb4 /091run_interactive.cc
parent8a0f55cdffc03ee10b0d7b6740db89e622b4c1c1 (diff)
downloadmu-9aacd50defdb4c6eb5d860a905af4d572cf7598a.tar.gz
2464: edit/: update errors in shape-shifting recipes
Requires carefully deleting specializations so that they can be
reintroduced each time.
Diffstat (limited to '091run_interactive.cc')
-rw-r--r--091run_interactive.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/091run_interactive.cc b/091run_interactive.cc
index a883a5ae..44fe5736 100644
--- a/091run_interactive.cc
+++ b/091run_interactive.cc
@@ -426,6 +426,23 @@ case RELOAD: {
     Type_ordinal.erase(get(Type, recently_added_types.at(i)).name);
     Type.erase(recently_added_types.at(i));
   }
+  for (map<string, vector<recipe_ordinal> >::iterator p = Recipe_variants.begin(); p != Recipe_variants.end(); ++p) {
+//?     cerr << p->first << ":\n";
+    vector<recipe_ordinal>& variants = p->second;
+    for (long long int i = 0; i < SIZE(p->second); ++i) {
+      if (variants.at(i) == -1) continue;
+      if (find(recently_added_shape_shifting_recipes.begin(), recently_added_shape_shifting_recipes.end(), variants.at(i)) != recently_added_shape_shifting_recipes.end()) {
+//?         cerr << "  " << variants.at(i) << ' ' << get(Recipe, variants.at(i)).name << '\n';
+        variants.at(i) = -1;  // ghost
+      }
+    }
+  }
+  for (long long int i = 0; i < SIZE(recently_added_shape_shifting_recipes); ++i) {
+//?     cerr << "erasing " << get(Recipe, recently_added_shape_shifting_recipes.at(i)).name << '\n';
+    Recipe_ordinal.erase(get(Recipe, recently_added_shape_shifting_recipes.at(i)).name);
+    Recipe.erase(recently_added_shape_shifting_recipes.at(i));
+  }
+  recently_added_shape_shifting_recipes.clear();
   string code = read_mu_string(ingredients.at(0).at(0));
   run_code_begin();
   routine* save_current_routine = Current_routine;