mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Remove useless copy constructions
A string was constructed, but only for checking if its empty. This can be done on the char pointer itself. Made a inline helper func to reduce duplicate code.
This commit is contained in:
parent
71652f02c7
commit
aa569173c9
@ -622,22 +622,18 @@ void CConsole::FindFromPartial(void)
|
||||
}
|
||||
if (con_suggest_showhelptext->GetBool())
|
||||
{
|
||||
if (pCommandBase->GetHelpText())
|
||||
std::function<void(string& , const char*)> fnAppendDocString = [&](string& svTarget, const char* pszDocString)
|
||||
{
|
||||
string svHelpText = pCommandBase->GetHelpText();
|
||||
if (!svHelpText.empty())
|
||||
if (VALID_CHARSTAR(pszDocString))
|
||||
{
|
||||
svValue.append(" - \"" + svHelpText + "\"");
|
||||
svTarget.append(" - \"");
|
||||
svTarget.append(pszDocString);
|
||||
svTarget.append("\"");
|
||||
}
|
||||
}
|
||||
if (pCommandBase->GetUsageText())
|
||||
{
|
||||
string svUsageText = pCommandBase->GetUsageText();
|
||||
if (!svUsageText.empty())
|
||||
{
|
||||
svValue.append(" - \"" + svUsageText + "\"");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
fnAppendDocString(svValue, pCommandBase->GetHelpText());
|
||||
fnAppendDocString(svValue, pCommandBase->GetUsageText());
|
||||
}
|
||||
m_vSuggest.push_back(CSuggest(pCommandName + svValue, pCommandBase->GetFlags()));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user