mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-01-31 18:07:14 +01:00
Fix the keybind creation process which was using the incorrect keybind identifier.
This commit is contained in:
parent
8591efbcce
commit
5f983cdacf
@ -729,25 +729,20 @@ Object & Core::NewKeybind(Int32 slot, bool release, Int32 primary, Int32 seconda
|
|||||||
{
|
{
|
||||||
slot = _Func->GetKeyBindUnusedSlot();
|
slot = _Func->GetKeyBindUnusedSlot();
|
||||||
}
|
}
|
||||||
// Validate the keybind slot
|
// Validate the keybind slot returned by the server
|
||||||
if (slot < 0)
|
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
|
// 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
|
// See if the entity creation failed on the server
|
||||||
if (_Func->GetLastError() == vcmpErrorArgumentOutOfBounds)
|
if (result == vcmpErrorArgumentOutOfBounds)
|
||||||
{
|
{
|
||||||
STHROWF("Out of bounds keybind argument: %d", id);
|
STHROWF("Out of bounds keybind argument: %d", slot);
|
||||||
}
|
|
||||||
// Validate the identifier returned by the server
|
|
||||||
else if (INVALID_ENTITYEX(id, SQMOD_KEYBIND_POOL))
|
|
||||||
{
|
|
||||||
STHROWF("Server returned invalid keybind: %d", id);
|
|
||||||
}
|
}
|
||||||
// Attempt to allocate this entity and return the result
|
// Attempt to allocate this entity and return the result
|
||||||
return AllocKeybind(id, true, header, payload);
|
return AllocKeybind(slot, true, header, payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user