Add toggling for string options

This commit is contained in:
Learath2 2017-06-20 11:27:14 +02:00
parent ed8effdec8
commit 5941755832

View file

@ -734,6 +734,14 @@ void CConsole::ConToggle(IConsole::IResult *pResult, void *pUser)
pConsole->ExecuteLine(aBuf);
aBuf[0] = 0;
}
else if(pfnCallback == StrVariableCommand)
{
CStrVariableData *pData = static_cast<CStrVariableData *>(pUserData);
const char *pStr = !str_comp(pData->m_pStr, pResult->GetString(1)) ? pResult->GetString(2) : pResult->GetString(1);
str_format(aBuf, sizeof(aBuf), "%s %s", pResult->GetString(0), pStr);
pConsole->ExecuteLine(aBuf);
aBuf[0] = 0;
}
else
str_format(aBuf, sizeof(aBuf), "Invalid command: '%s'.", pResult->GetString(0));
}