about summary refs log tree commit diff stats
path: root/057shape_shifting_container.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-03-19 00:24:52 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-03-19 00:24:52 -0700
commit1d1faace5d624b7bac96eb57a9373d2511ac08e1 (patch)
tree674aadb7229e9bf6c5da55c09d1ac8a1af1693c0 /057shape_shifting_container.cc
parentd15c554a51c77cf1eb736363a63dbd8b5e006d49 (diff)
downloadmu-1d1faace5d624b7bac96eb57a9373d2511ac08e1.tar.gz
2790
The issue alluded to in the previous 2789 is now fixed. I'm not happy
with my solution, though. I pollute Type_ordinal with type ingredients
in parse_type_tree and simply ignore such entries later on. I'd much
rather avoid the pollution in the first place, but I'm not sure how to
do that..
Diffstat (limited to '057shape_shifting_container.cc')
-rw-r--r--057shape_shifting_container.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/057shape_shifting_container.cc b/057shape_shifting_container.cc
index 1a458bb7..04b5900f 100644
--- a/057shape_shifting_container.cc
+++ b/057shape_shifting_container.cc
@@ -94,8 +94,9 @@ void read_type_ingredients(string& name) {
 
 :(before "End insert_container Special-cases")
 // check for use of type ingredients
-else if (is_type_ingredient_name(type->name)) {
+else if (!type->name.empty() && is_type_ingredient_name(type->name)) {
   type->value = get(info.type_ingredient_names, type->name);
+  goto recurse;
 }
 :(code)
 bool is_type_ingredient_name(const string& type) {
@@ -239,6 +240,7 @@ bool contains_type_ingredient(const reagent& x) {
 bool contains_type_ingredient(const type_tree* type) {
   if (!type) return false;
   if (type->value >= START_TYPE_INGREDIENTS) return true;
+  assert(!is_type_ingredient_name(type->name));
   return contains_type_ingredient(type->left) || contains_type_ingredient(type->right);
 }