Skip to content

Commit 096a7e9

Browse files
committed
Revert "Fixed key binds being deleted on disconnect"
This reverts commit 65d4d3b.
1 parent 89b7a79 commit 096a7e9

File tree

3 files changed

+8
-16
lines changed

3 files changed

+8
-16
lines changed

Client/core/CCommands.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,13 +212,9 @@ tagCOMMANDENTRY* CCommands::Get ( const char* szCommand, bool bCheckIfMod, bool
212212
{
213213
// Find the entry we're looking for
214214
auto iter = std::find_if(m_CommandList.begin(), m_CommandList.end(),
215-
[szCommand, bCheckIfMod, bModCommand](auto& command)
215+
[szCommand](auto& command)
216216
{
217-
if ( !bCheckIfMod || ( bModCommand == command.bModCommand ) )
218-
{
219-
return stricmp(szCommand, command.szCommandName) == 0;
220-
}
221-
return false;
217+
return stricmp(szCommand, command.szCommandName) == 0;
222218
});
223219

224220
if (iter != m_CommandList.end())

Client/core/CKeyBinds.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ void CKeyBinds::RemoveDeletedBinds ( void )
507507
void CKeyBinds::ClearCommandsAndControls ( void )
508508
{
509509
m_List.remove_if([](auto& pBind) {
510-
return pBind->GetType() != KEY_BIND_FUNCTION && pBind->GetType() != KEY_BIND_CONTROL_FUNCTION;
510+
return pBind->GetType() == KEY_BIND_FUNCTION || pBind->GetType() == KEY_BIND_CONTROL_FUNCTION;
511511
});
512512
}
513513

@@ -706,10 +706,6 @@ bool CKeyBinds::RemoveAllCommands ( void )
706706
return false;
707707
if (pBind->GetType() != KEY_BIND_COMMAND)
708708
return false;
709-
if (m_bProcessingKeyStroke) {
710-
pBind->beingDeleted = true;
711-
return false;
712-
}
713709
return true;
714710
});
715711
return bFound;
@@ -1614,7 +1610,7 @@ bool CKeyBinds::RemoveAllControlFunctions ( ControlFunctionBindHandler Handler )
16141610
[&](auto& pBind) {
16151611
if (pBind->IsBeingDeleted())
16161612
return false;
1617-
if (pBind->GetType() != KEY_BIND_CONTROL_FUNCTION)
1613+
if (pBind->GetType() == KEY_BIND_CONTROL_FUNCTION)
16181614
return false;
16191615
CControlFunctionBind* pControlBind = static_cast<CControlFunctionBind*>(pBind.get());
16201616
if (pControlBind->Handler != Handler)
@@ -1640,7 +1636,7 @@ bool CKeyBinds::RemoveAllControlFunctions ( void )
16401636
[&](auto& pBind) {
16411637
if (pBind->IsBeingDeleted())
16421638
return false;
1643-
if (pBind->GetType() != KEY_BIND_CONTROL_FUNCTION)
1639+
if (pBind->GetType() == KEY_BIND_CONTROL_FUNCTION)
16441640
return false;
16451641
bFound = true;
16461642

Client/core/Settings/CBindSettingsTab.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ void CBindSettingsTab::Initialize(void)
395395
for (int k = 0; k < SecKeyNum; k++)
396396
m_pBindsList->SetItemText(iBind, m_hSecKeys[k], CORE_SETTINGS_NO_KEY);
397397
m_pBindsList->SetItemData(iBind, m_hBind, (void*)KEY_BIND_GTA_CONTROL);
398-
m_pBindsList->SetItemData(iBind, m_hPriKey, (void*)pGTABind);
398+
m_pBindsList->SetItemData(iBind, m_hPriKey, (void*)&pGTABind);
399399
iGameRowCount++;
400400
}
401401
// Secondary keys?
@@ -404,7 +404,7 @@ void CBindSettingsTab::Initialize(void)
404404
if (uiMatchCount == k + 1)
405405
{
406406
m_pBindsList->SetItemText(iBind, m_hSecKeys[k], pGTABind->boundKey->szKey);
407-
m_pBindsList->SetItemData(iBind, m_hSecKeys[k], (void*)pGTABind);
407+
m_pBindsList->SetItemData(iBind, m_hSecKeys[k], (void*)&pGTABind);
408408
}
409409
uiMatchCount++;
410410
}
@@ -460,7 +460,7 @@ void CBindSettingsTab::Initialize(void)
460460
if (pListedCommand->uiMatchCount == k)
461461
{
462462
m_pBindsList->SetItemText(pListedCommand->iIndex, m_hSecKeys[k], pCommandBind->boundKey->szKey);
463-
m_pBindsList->SetItemData(pListedCommand->iIndex, m_hSecKeys[k], (void*)pCommandBind);
463+
m_pBindsList->SetItemData(pListedCommand->iIndex, m_hSecKeys[k], (void*)&pCommandBind);
464464
}
465465
pListedCommand->uiMatchCount++;
466466
}

0 commit comments

Comments
 (0)