Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
Abc Dr committed Jun 15, 2024
1 parent ca76c27 commit 62052aa
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/Source/autofunc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,17 +192,18 @@ void AutoFunc::TriggerEvent(const char* eventname,
if (s_dicEventCmd.find(eventname) != s_dicEventCmd.end()) {
std::string ssbuf = s_dicEventCmd[eventname];
if (ssbuf.size() > 0) {
static auto replace = [&ssbuf](const char* key, const char* value) {
static auto replace = [](const char* key, const char* value, std::string& ss) {
if (value) {
std::string temp1 = ss;
std::regex pattern(key);
std::string temp = std::regex_replace(ssbuf, pattern, value);
ssbuf = temp;
std::string temp = std::regex_replace(temp1, pattern, value);
ss = temp;
}
};
replace("\\{param1\\}", param1);
replace("\\{param2\\}", param2);
replace("\\{param3\\}", param3);
replace("\\{param4\\}", param4);
replace("\\{param1\\}", param1, ssbuf);
replace("\\{param2\\}", param2, ssbuf);
replace("\\{param3\\}", param3, ssbuf);
replace("\\{param4\\}", param4, ssbuf);
EngineClientCmd(ssbuf.c_str());
}
}
Expand Down

0 comments on commit 62052aa

Please sign in to comment.