mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-18 05:58:19 +00:00
Merge pull request #9005 from Robyt3/Client-Toggle-Fix
Fix `toggle` command always setting value to `1`
This commit is contained in:
commit
b34edb64c0
|
@ -492,7 +492,8 @@ void CConfigManager::Con_Toggle(IConsole::IResult *pResult, void *pUserData)
|
|||
if(pVariable->m_Type == SConfigVariable::VAR_INT)
|
||||
{
|
||||
SIntConfigVariable *pIntVariable = static_cast<SIntConfigVariable *>(pVariable);
|
||||
pIntVariable->SetValue(*pIntVariable->m_pVariable == pResult->GetInteger(pResult->GetInteger(1) ? 2 : 1));
|
||||
const bool EqualToFirst = *pIntVariable->m_pVariable == pResult->GetInteger(1);
|
||||
pIntVariable->SetValue(pResult->GetInteger(EqualToFirst ? 2 : 1));
|
||||
}
|
||||
else if(pVariable->m_Type == SConfigVariable::VAR_COLOR)
|
||||
{
|
||||
|
@ -504,7 +505,8 @@ void CConfigManager::Con_Toggle(IConsole::IResult *pResult, void *pUserData)
|
|||
else if(pVariable->m_Type == SConfigVariable::VAR_STRING)
|
||||
{
|
||||
SStringConfigVariable *pStringVariable = static_cast<SStringConfigVariable *>(pVariable);
|
||||
pStringVariable->SetValue(pResult->GetString(str_comp(pStringVariable->m_pStr, pResult->GetString(1)) == 0 ? 2 : 1));
|
||||
const bool EqualToFirst = str_comp(pStringVariable->m_pStr, pResult->GetString(1)) == 0;
|
||||
pStringVariable->SetValue(pResult->GetString(EqualToFirst ? 2 : 1));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue