mirror of
https://github.com/ddnet/ddnet.git
synced 2024-09-20 09:34:19 +00:00
Merge #6448
6448: Fix console chain of `inp_controller_guid` r=def- a=Robyt3 The console chain was broken due to `joystick_guid` being renamed to `inp_controller_guid`, so the active controller was not being updated when the GUID is changed via the console. ## Checklist - [X] Tested the change ingame - [ ] Provided screenshots if it is a visual change - [ ] Tested in combination with possibly related configuration options - [ ] Written a unit test (especially base/) or added coverage to integration test - [ ] Considered possible null pointers and out of bounds array indexing - [ ] Changed no physics that affect existing maps - [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional) Co-authored-by: Robert Müller <robytemueller@gmail.com>
This commit is contained in:
commit
323d8bbb9d
|
@ -101,7 +101,7 @@ void CInput::InitJoysticks()
|
|||
OpenJoystick(i);
|
||||
UpdateActiveJoystick();
|
||||
|
||||
Console()->Chain("joystick_guid", ConchainJoystickGuidChanged, this);
|
||||
Console()->Chain("inp_controller_guid", ConchainJoystickGuidChanged, this);
|
||||
}
|
||||
|
||||
bool CInput::OpenJoystick(int JoystickIndex)
|
||||
|
@ -145,7 +145,10 @@ void CInput::UpdateActiveJoystick()
|
|||
void CInput::ConchainJoystickGuidChanged(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
|
||||
{
|
||||
pfnCallback(pResult, pCallbackUserData);
|
||||
if(pResult->NumArguments() == 1)
|
||||
{
|
||||
static_cast<CInput *>(pUserData)->UpdateActiveJoystick();
|
||||
}
|
||||
}
|
||||
|
||||
float CInput::GetJoystickDeadzone()
|
||||
|
|
Loading…
Reference in a new issue