about summary refs log tree commit diff stats
path: root/freevars.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'freevars.cpp')
-rw-r--r--freevars.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/freevars.cpp b/freevars.cpp index 8c3eda4..54c5aab 100644 --- a/freevars.cpp +++ b/freevars.cpp
@@ -34,8 +34,8 @@ std::string freevars::parse(std::string in)
34 for (std::map<std::string, std::vector<std::string>* >::iterator it = vars->begin(); it != vars->end(); it++) 34 for (std::map<std::string, std::vector<std::string>* >::iterator it = vars->begin(); it != vars->end(); it++)
35 { 35 {
36 std::string tofind = "$" + it->first + "$"; 36 std::string tofind = "$" + it->first + "$";
37 size_t fpos = res.find(tofind); 37 size_t fpos;
38 if (fpos != std::string::npos) 38 while ((fpos = res.find(tofind)) != std::string::npos)
39 { 39 {
40 int r = rand() % it->second->size(); 40 int r = rand() % it->second->size();
41 res.replace(fpos, tofind.length(), (*it->second)[r], 0, std::string::npos); 41 res.replace(fpos, tofind.length(), (*it->second)[r], 0, std::string::npos);