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 (con_suggest_showhelptext->GetBool())
|
||||||
{
|
{
|
||||||
if (pCommandBase->GetHelpText())
|
std::function<void(string& , const char*)> fnAppendDocString = [&](string& svTarget, const char* pszDocString)
|
||||||
{
|
{
|
||||||
string svHelpText = pCommandBase->GetHelpText();
|
if (VALID_CHARSTAR(pszDocString))
|
||||||
if (!svHelpText.empty())
|
|
||||||
{
|
{
|
||||||
svValue.append(" - \"" + svHelpText + "\"");
|
svTarget.append(" - \"");
|
||||||
|
svTarget.append(pszDocString);
|
||||||
|
svTarget.append("\"");
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
if (pCommandBase->GetUsageText())
|
|
||||||
{
|
fnAppendDocString(svValue, pCommandBase->GetHelpText());
|
||||||
string svUsageText = pCommandBase->GetUsageText();
|
fnAppendDocString(svValue, pCommandBase->GetUsageText());
|
||||||
if (!svUsageText.empty())
|
|
||||||
{
|
|
||||||
svValue.append(" - \"" + svUsageText + "\"");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
m_vSuggest.push_back(CSuggest(pCommandName + svValue, pCommandBase->GetFlags()));
|
m_vSuggest.push_back(CSuggest(pCommandName + svValue, pCommandBase->GetFlags()));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user