about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2017-01-06 22:09:29 -0800
committerKartik K. Agaram <vc@akkartik.com>2017-01-06 22:09:29 -0800
commit61fb1da0b624ce20960c5e8b2229ca3d7f0e4fcd (patch)
tree327fecd98e3e6c7096fe0854f557c95b20a0046d
parent58f19b4c41f5c4ca9fec1515fe5e24732eda19b7 (diff)
downloadmu-61fb1da0b624ce20960c5e8b2229ca3d7f0e4fcd.tar.gz
3730
Properly support reloading lessons containing scenarios in edit/ and
sandbox/ apps.

I was so sure I tested this for commit 3724, but apparently not.
-rw-r--r--101run_sandboxed.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/101run_sandboxed.cc b/101run_sandboxed.cc
index a3b6292e..d6680f0e 100644
--- a/101run_sandboxed.cc
+++ b/101run_sandboxed.cc
@@ -135,6 +135,8 @@ map<type_ordinal, type_info> Type_snapshot_stash;
 map<recipe_ordinal, map<string, int> > Name_snapshot_stash;
 map<string, vector<recipe_ordinal> > Recipe_variants_snapshot_stash;
 map<string, type_tree*> Type_abbreviations_snapshot_stash;
+vector<scenario> Scenarios_snapshot_stash;
+set<string> Scenario_names_snapshot_stash;
 
 :(code)
 void run_code_begin(bool should_stash_snapshots) {
@@ -179,6 +181,10 @@ void stash_snapshots() {
   Recipe_variants_snapshot_stash = Recipe_variants_snapshot;
   assert(Type_abbreviations_snapshot_stash.empty());
   Type_abbreviations_snapshot_stash = Type_abbreviations_snapshot;
+  assert(Scenarios_snapshot_stash.empty());
+  Scenarios_snapshot_stash = Scenarios_snapshot;
+  assert(Scenario_names_snapshot_stash.empty());
+  Scenario_names_snapshot_stash = Scenario_names_snapshot;
   save_snapshots();
 }
 void unstash_snapshots() {
@@ -190,6 +196,8 @@ void unstash_snapshots() {
   Name_snapshot = Name_snapshot_stash;  Name_snapshot_stash.clear();
   Recipe_variants_snapshot = Recipe_variants_snapshot_stash;  Recipe_variants_snapshot_stash.clear();
   Type_abbreviations_snapshot = Type_abbreviations_snapshot_stash;  Type_abbreviations_snapshot_stash.clear();
+  Scenarios_snapshot = Scenarios_snapshot_stash;  Scenarios_snapshot_stash.clear();
+  Scenario_names_snapshot = Scenario_names_snapshot_stash;  Scenario_names_snapshot_stash.clear();
 }
 
 :(before "End Load Recipes")