Skip to content

Commit

Permalink
Fix having to use bindKey twice at user-changed key (#237)
Browse files Browse the repository at this point in the history
  • Loading branch information
emre1702 authored and ccw808 committed Jul 10, 2018
1 parent 1c7d3b1 commit df11335
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp
Expand Up @@ -6431,28 +6431,32 @@ bool CStaticFunctionDefinitions::BindKey(const char* szKey, const char* szHitSta
if (bKey)
{
bool bHitState = true;
// Activate all keys for this command
pKeyBinds->SetAllCommandsActive(szResource, true, szCommandName, bHitState, szArguments, true, szKey);
// Check if its binded already (dont rebind)
if (pKeyBinds->CommandExists(szKey, szCommandName, true, bHitState, szArguments, szResource, true, true))
{
// Activate all keys for this command
pKeyBinds->SetAllCommandsActive(szResource, true, szCommandName, bHitState, szArguments, true, szKey);
return true;
}

if ((!stricmp(szHitState, "down") || !stricmp(szHitState, "both")) &&
pKeyBinds->AddCommand(szKey, szCommandName, szArguments, bHitState, szResource, true))
{
pKeyBinds->SetCommandActive(szKey, szCommandName, bHitState, szArguments, szResource, true, true);
pKeyBinds->SetAllCommandsActive(szResource, true, szCommandName, bHitState, szArguments, true, szKey);
bSuccess = true;
}

bHitState = false;
pKeyBinds->SetAllCommandsActive(szResource, true, szCommandName, bHitState, szArguments, true, szKey);
if (pKeyBinds->CommandExists(szKey, szCommandName, true, bHitState, szArguments, szResource, true, true))
{
pKeyBinds->SetAllCommandsActive(szResource, true, szCommandName, bHitState, szArguments, true, szKey);
return true;
}

if ((!stricmp(szHitState, "up") || !stricmp(szHitState, "both")) &&
pKeyBinds->AddCommand(szKey, szCommandName, szArguments, bHitState, szResource, true))
{
pKeyBinds->SetCommandActive(szKey, szCommandName, bHitState, szArguments, szResource, true, true);
pKeyBinds->SetAllCommandsActive(szResource, true, szCommandName, bHitState, szArguments, true, szKey);
bSuccess = true;
}
}
Expand Down

0 comments on commit df11335

Please sign in to comment.