Examples of errors detected by the V3040 diagnostic
V3040. The expression contains a suspicious mix of integer and real types.
S&Box
V3040 The 'triggerDeadzone' constant of the 'float' type is compared to a value of the 'int' type. InputRouter.Input.cs 207
internal static void OnGameControllerAxis(
int deviceId,
GameControllerAxis axis,
int value )
{
controller.SetAxis( axis, value );
....
const float triggerDeadzone = 0.75f;
// I hate this but okay
GamepadCode code =
axis switch
{
GameControllerAxis.TriggerLeft =>
GamepadCode.LeftTrigger,
GameControllerAxis.TriggerRight =>
GamepadCode.RightTrigger,
_ =>
GamepadCode.None,
};
OnGamepadCode(deviceId, code, value >= triggerDeadzone );
}