From ce1ccb26714ca2ec60d09587582362413b9cdb61 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Tue, 13 Sep 2016 13:50:47 -0400 Subject: Fixed bug where variable values would carry over --- yandere.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'yandere.cpp') diff --git a/yandere.cpp b/yandere.cpp index 3cb5efa..ec7322d 100644 --- a/yandere.cpp +++ b/yandere.cpp @@ -99,6 +99,9 @@ int main(int argc, char** argv) for (;;) { std::cout << "Generating tweet" << std::endl; + + std::map variables; + std::string action = "{MAIN}"; int tknloc; while ((tknloc = action.find("{")) != std::string::npos) @@ -129,6 +132,9 @@ int main(int argc, char** argv) if (canontkn == "\\N") { result = "\n"; + } else if (variables.count(canontkn) == 1) + { + result = variables[canontkn]; } else { auto& group = groups[canontkn]; std::uniform_int_distribution dist(0, group.size() - 1); @@ -138,7 +144,7 @@ int main(int argc, char** argv) if (!eqvarname.empty()) { - groups[eqvarname].push_back(result); + variables[eqvarname] = result; } if (modifier == "indefinite") -- cgit 1.4.1