about summary refs log tree commit diff stats
path: root/cpp/041name.cc
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/041name.cc')
-rw-r--r--cpp/041name.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/cpp/041name.cc b/cpp/041name.cc
index ac7c751c..23972393 100644
--- a/cpp/041name.cc
+++ b/cpp/041name.cc
@@ -30,7 +30,9 @@ for (size_t i = 0; i < recently_added_recipes.size(); ++i) {
 :(code)
 void transform_names(const recipe_number r) {
   map<string, int>& names = Name[r];
-  int curr_idx = 1;
+  // store the indices 'used' so far in the map
+  int& curr_idx = names[""];
+  ++curr_idx;  // avoid using index 0, benign skip in some other cases
 //?   cout << "Recipe " << r << ": " << Recipe[r].name << '\n'; //? 3
 //?   cout << Recipe[r].steps.size() << '\n'; //? 2
   for (size_t i = 0; i < Recipe[r].steps.size(); ++i) {