effort to have no warnings once again

This commit is contained in:
2024-10-13 21:32:31 +03:00
parent d884cd45d9
commit da98c0941b
15 changed files with 84 additions and 43 deletions

View File

@ -15,6 +15,12 @@ static void update_action_pressed_state(InputState *input, Action *action) {
switch (action->bindings[i].source) {
case BUTTON_SOURCE_NOT_SET:
break;
case BUTTON_SOURCE_KEYBOARD_CHARACTER:
CRY("Action pressed state updated failed", "BUTTON_SOURCE_KEYBOARD_CHARACTER isn't handled");
break;
case BUTTON_SOURCE_GAMEPAD:
CRY("Action pressed state updated failed", "BUTTON_SOURCE_GAMEPAD isn't handled");
break;
case BUTTON_SOURCE_KEYBOARD_PHYSICAL:
/* not pressed */
if (input->keyboard_state[action->bindings[i].code.scancode] == 0) {
@ -98,6 +104,8 @@ static void input_bind_code_to_action(InputState *input,
case BUTTON_SOURCE_MOUSE:
is_already_bound = binding->code.mouse_button == code.mouse_button;
break;
default:
SDL_assert(false);
}
if (is_already_bound) {
@ -156,6 +164,8 @@ static void input_unbind_code_from_action(InputState *input,
case BUTTON_SOURCE_MOUSE:
is_bound = binding->code.mouse_button == code.mouse_button;
break;
default:
SDL_assert(false);
}
/* stop early, this won't change */
@ -220,7 +230,7 @@ void input_bind_action_control(char const *action_name,
input_bind_code_to_action(&ctx.input,
action_name,
BUTTON_SOURCE_MOUSE,
(union ButtonCode) { .mouse_button = SDL_BUTTON(mouse_button)});
(union ButtonCode) { .mouse_button = (uint8_t)SDL_BUTTON(mouse_button)});
} else
log_warn("(%s) Invalid control value given: %i.", __func__, control);
}
@ -242,7 +252,7 @@ void input_unbind_action_control(char const *action_name,
input_unbind_code_from_action(&ctx.input,
action_name,
BUTTON_SOURCE_MOUSE,
(union ButtonCode) { .mouse_button = SDL_BUTTON(mouse_button)});
(union ButtonCode) { .mouse_button = (uint8_t)SDL_BUTTON(mouse_button)});
} else
log_warn("(%s) Invalid control value given: %i.", __func__, control);
}