| 537 | }; |
| 538 | |
| 539 | bool CheckTextCommand(const string_view text) |
| 540 | { |
| 541 | if (text.size() < 1 || text[0] != '/') |
| 542 | return false; |
| 543 | |
| 544 | auto textCmdIterator = std::find_if(TextCmdList.begin(), TextCmdList.end(), [&](const TextCmdItem &elem) { return text.find(elem.text) == 0 && (text.length() == elem.text.length() || text[elem.text.length()] == ' '); }); |
| 545 | if (textCmdIterator == TextCmdList.end()) { |
| 546 | InitDiabloMsg(StrCat(_("Command \""), text, "\" is unknown.")); |
| 547 | return true; |
| 548 | } |
| 549 | |
| 550 | TextCmdItem &textCmd = *textCmdIterator; |
| 551 | string_view parameter = ""; |
| 552 | if (text.length() > (textCmd.text.length() + 1)) |
| 553 | parameter = text.substr(textCmd.text.length() + 1); |
| 554 | const std::string result = textCmd.actionProc(parameter); |
| 555 | if (result != "") |
| 556 | InitDiabloMsg(result); |
| 557 | return true; |
| 558 | } |
| 559 | |
| 560 | void ResetTalkMsg() |
| 561 | { |
no test coverage detected