MCPcopy Create free account
hub / github.com/diasurgical/DevilutionX / CheckTextCommand

Function CheckTextCommand

Source/control.cpp:539–558  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

537};
538
539bool 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
560void ResetTalkMsg()
561{

Callers 2

ResetTalkMsgFunction · 0.85
DiabloHotkeyMsgFunction · 0.85

Calls 5

InitDiabloMsgFunction · 0.85
StrCatFunction · 0.85
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected