about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2016-09-13 13:50:47 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2016-09-13 13:50:47 -0400
commitce1ccb26714ca2ec60d09587582362413b9cdb61 (patch)
tree2d0d8ff749d78ce9695871f4c3cf52261d2006a2
parentfa26336b8b792a82349e89bcbf7b2c7833f7f420 (diff)
downloadyandere-ce1ccb26714ca2ec60d09587582362413b9cdb61.tar.gz
yandere-ce1ccb26714ca2ec60d09587582362413b9cdb61.tar.bz2
yandere-ce1ccb26714ca2ec60d09587582362413b9cdb61.zip
Fixed bug where variable values would carry over
m---------vendor/libtwittercpp0
-rw-r--r--yandere.cpp8
2 files changed, 7 insertions, 1 deletions
diff --git a/vendor/libtwittercpp b/vendor/libtwittercpp
Subproject bebcdec016124fceeeb393b8807ecf65f662958 Subproject febadca7d4e0460aa78f95b53b5e36e51fd2f97
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)
99 for (;;) 99 for (;;)
100 { 100 {
101 std::cout << "Generating tweet" << std::endl; 101 std::cout << "Generating tweet" << std::endl;
102
103 std::map<std::string, std::string> variables;
104
102 std::string action = "{MAIN}"; 105 std::string action = "{MAIN}";
103 int tknloc; 106 int tknloc;
104 while ((tknloc = action.find("{")) != std::string::npos) 107 while ((tknloc = action.find("{")) != std::string::npos)
@@ -129,6 +132,9 @@ int main(int argc, char** argv)
129 if (canontkn == "\\N") 132 if (canontkn == "\\N")
130 { 133 {
131 result = "\n"; 134 result = "\n";
135 } else if (variables.count(canontkn) == 1)
136 {
137 result = variables[canontkn];
132 } else { 138 } else {
133 auto& group = groups[canontkn]; 139 auto& group = groups[canontkn];
134 std::uniform_int_distribution<int> dist(0, group.size() - 1); 140 std::uniform_int_distribution<int> dist(0, group.size() - 1);
@@ -138,7 +144,7 @@ int main(int argc, char** argv)
138 144
139 if (!eqvarname.empty()) 145 if (!eqvarname.empty())
140 { 146 {
141 groups[eqvarname].push_back(result); 147 variables[eqvarname] = result;
142 } 148 }
143 149
144 if (modifier == "indefinite") 150 if (modifier == "indefinite")