ValveSoftware / ValveSoftware/source-sdk-2013
IsKeypad function logic is incorrect
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 10k
- Forks
- 3k
- Avg merge
- 8d 11h
- Merged PRs (30d)
- 2
Description
Currently, the IsKeypad function in inputsystem is implemented as:
This code doesn't work, because the MOUSE_FIRST enum value checked for the lower bound is larger than the KEY_PAD_DECIMAL value that is checked for the upper bound. Therefore, this function currently returns false for all inputs.
This is probably a typo, and the lower bound should be checked against KEY_PAD_0 instead of MOUSE_FIRST:
return ( code >= KEY_PAD_0 ) && ( code <= KEY_PAD_DECIMAL );
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open src/public/inputsystem/ButtonCode.h at the IsKeypad function around lines 311-314 and inspect the keypad enum range. Confirm that the function recognizes codes from KEY_PAD_0 through KEY_PAD_DECIMAL; the issue is done when keypad inputs no longer return false because of the lower-bound check.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100