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 --- vendor/libtwittercpp | 2 +- yandere.cpp | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/vendor/libtwittercpp b/vendor/libtwittercpp index bebcdec..febadca 160000 --- a/vendor/libtwittercpp +++ b/vendor/libtwittercpp @@ -1 +1 @@ -Subproject commit bebcdec016124fceeeb393b8807ecf65f662958c +Subproject commit febadca7d4e0460aa78f95b53b5e36e51fd2f97d 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