diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-11-06 11:06:58 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-11-06 11:17:25 -0800 |
commit | 795f5244abc9b9f26ff621fd1997db427289d2ba (patch) | |
tree | 7018937b9d11ad07dab840789c444ca82ba22333 /054dilated_reagent.cc | |
parent | 90e9eb3d4fa431ed0e7864caead19cd2e06b2c65 (diff) | |
download | mu-795f5244abc9b9f26ff621fd1997db427289d2ba.tar.gz |
2377 - stop using operator[] in map
I'm still seeing all sorts of failures in turning on layer 11 of edit/, so I'm backing away and nailing down every culprit I run into. First up: stop accidentally inserting empty objects into maps during lookups. Commands run: $ sed -i 's/\(Recipe_ordinal\|Recipe\|Type_ordinal\|Type\|Memory\)\[\([^]]*\)\] = \(.*\);/put(\1, \2, \3);/' 0[1-9]* $ vi 075scenario_console.cc # manually fix up Memory[Memory[CONSOLE]] $ sed -i 's/\(Memory\)\[\([^]]*\)\]/get_or_insert(\1, \2)/' 0[1-9]* $ sed -i 's/\(Recipe_ordinal\|Type_ordinal\)\[\([^]]*\)\]/get(\1, \2)/' 0[1-9]* $ sed -i 's/\(Recipe\|Type\)\[\([^]]*\)\]/get(\1, \2)/' 0[1-9]* Now mu dies pretty quickly because of all the places I try to lookup a missing value.
Diffstat (limited to '054dilated_reagent.cc')
-rw-r--r-- | 054dilated_reagent.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/054dilated_reagent.cc b/054dilated_reagent.cc index 46f5f8ab..5ac1c97e 100644 --- a/054dilated_reagent.cc +++ b/054dilated_reagent.cc @@ -86,9 +86,9 @@ if (s.at(0) == '{') { string type_name = properties.at(0).second->value; if (Type_ordinal.find(type_name) == Type_ordinal.end()) { // this type can't be an integer literal - Type_ordinal[type_name] = Next_type_ordinal++; + put(Type_ordinal, type_name, Next_type_ordinal++); } - type = new type_tree(Type_ordinal[type_name]); + type = new type_tree(get(Type_ordinal, type_name)); return; } |