Skip to content

Unhardcode integer key IDs #5790

Description

@sprunk

These shouldn't use string.byte or raw numbers. Use Spring.GetKeyCode instead, or perhaps KEYSYMS (KEYSYMS is sort of deprecated too but commonly used and acceptable for now). 304 is probably just left shift, test if right shift works. Part of the task is to look around if there's more of these.

if key == 304 then
shifted = true
end
if key == 46 and mods.alt then
CycleUnitDisplay(1) -- cycle forward
end
if key == 44 and mods.alt then

local incCylinder = string.byte( "/" )
local decCylinder = string.byte( "." )
local targetingMod = string.byte( "\\" )
local hideBallisticPlot = string.byte( "n" )
function widget:KeyPress(key, mods, isRepeat)
if ( key == incGravity ) then
customMyGravity = customMyGravity + ((isRepeat and 1) or 0.1)
return true
elseif ( key == decGravity ) then

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendStuff that makes code easier to work with, without affecting the end user

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions