Skip to content

Commit

Permalink
allow more than one instance of a replacement string; e.g. the second…
Browse files Browse the repository at this point in the history
… rep1 here: %rep1%a %rep2%b %rep1%
  • Loading branch information
planqi committed Nov 2, 2018
1 parent 448ed89 commit d0c81f3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions BH/Modules/Item/ItemDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,9 @@ void SubstituteNameVariables(UnitItemInfo *uInfo, string &name, Action *action)
};
name.assign(action->name);
for (int n = 0; n < sizeof(replacements) / sizeof(replacements[0]); n++) {
if (name.find("%" + replacements[n].key + "%") == string::npos)
continue;
name.replace(name.find("%" + replacements[n].key + "%"), replacements[n].key.length() + 2, replacements[n].value);
while (name.find("%" + replacements[n].key + "%") != string::npos) {
name.replace(name.find("%" + replacements[n].key + "%"), replacements[n].key.length() + 2, replacements[n].value);
}
}

// stat replacements
Expand Down

0 comments on commit d0c81f3

Please sign in to comment.