1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-01-19 03:57:14 +01:00

Fix the keybind creation process which was using the incorrect keybind identifier.

This commit is contained in:
Sandu Liviu Catalin 2016-06-20 09:02:13 +03:00
parent 8591efbcce
commit 5f983cdacf

View File

@ -729,25 +729,20 @@ Object & Core::NewKeybind(Int32 slot, bool release, Int32 primary, Int32 seconda
{
slot = _Func->GetKeyBindUnusedSlot();
}
// Validate the keybind slot
if (slot < 0)
// Validate the keybind slot returned by the server
if (INVALID_ENTITYEX(slot, SQMOD_KEYBIND_POOL))
{
STHROWF("Out of keybind slots");
STHROWF("Server returned invalid keybind slot: %d", slot);
}
// Request the server to create this entity
const Int32 id = _Func->RegisterKeyBind(slot, release, primary, secondary, alternative);
const vcmpError result = _Func->RegisterKeyBind(slot, release, primary, secondary, alternative);
// See if the entity creation failed on the server
if (_Func->GetLastError() == vcmpErrorArgumentOutOfBounds)
if (result == vcmpErrorArgumentOutOfBounds)
{
STHROWF("Out of bounds keybind argument: %d", id);
}
// Validate the identifier returned by the server
else if (INVALID_ENTITYEX(id, SQMOD_KEYBIND_POOL))
{
STHROWF("Server returned invalid keybind: %d", id);
STHROWF("Out of bounds keybind argument: %d", slot);
}
// Attempt to allocate this entity and return the result
return AllocKeybind(id, true, header, payload);
return AllocKeybind(slot, true, header, payload);
}
// --------------------------------------------------------------------------------------------