mirror of https://github.com/OpenRCT2/OpenRCT2.git
Use named casts on openrct2-ui/input
This commit is contained in:
parent
8920c36170
commit
8823658972
|
@ -110,7 +110,7 @@ static void game_handle_key_scroll()
|
|||
|
||||
static int32_t input_scancode_to_rct_keycode(int32_t sdl_key)
|
||||
{
|
||||
char keycode = (char)SDL_GetKeyFromScancode((SDL_Scancode)sdl_key);
|
||||
char keycode = static_cast<char>(SDL_GetKeyFromScancode(static_cast<SDL_Scancode>(sdl_key)));
|
||||
|
||||
// Until we reshuffle the text files to use the new positions
|
||||
// this will suffice to move the majority to the correct positions.
|
||||
|
|
|
@ -230,14 +230,14 @@ ScreenCoordsXY KeyboardShortcuts::GetKeyboardMapScroll(const uint8_t* keysState)
|
|||
|
||||
// Check if SHIFT is either set in the shortcut key and currently pressed,
|
||||
// or not set in the shortcut key and not currently pressed (in other words: check if they match).
|
||||
if ((bool)(shortcutKey & SHIFT) != (keysState[SDL_SCANCODE_LSHIFT] || keysState[SDL_SCANCODE_RSHIFT]))
|
||||
if (static_cast<bool>(shortcutKey & SHIFT) != (keysState[SDL_SCANCODE_LSHIFT] || keysState[SDL_SCANCODE_RSHIFT]))
|
||||
continue;
|
||||
if ((bool)(shortcutKey & CTRL) != (keysState[SDL_SCANCODE_LCTRL] || keysState[SDL_SCANCODE_RCTRL]))
|
||||
if (static_cast<bool>(shortcutKey & CTRL) != (keysState[SDL_SCANCODE_LCTRL] || keysState[SDL_SCANCODE_RCTRL]))
|
||||
continue;
|
||||
if ((bool)(shortcutKey & ALT) != (keysState[SDL_SCANCODE_LALT] || keysState[SDL_SCANCODE_RALT]))
|
||||
if (static_cast<bool>(shortcutKey & ALT) != (keysState[SDL_SCANCODE_LALT] || keysState[SDL_SCANCODE_RALT]))
|
||||
continue;
|
||||
#ifdef __MACOSX__
|
||||
if ((bool)(shortcutKey & CMD) != (keysState[SDL_SCANCODE_LGUI] || keysState[SDL_SCANCODE_RGUI]))
|
||||
if (static_cast<bool>(shortcutKey & CMD) != (keysState[SDL_SCANCODE_LGUI] || keysState[SDL_SCANCODE_RGUI]))
|
||||
continue;
|
||||
#endif
|
||||
switch (shortcutId)
|
||||
|
|
|
@ -483,7 +483,7 @@ static void input_window_resize_begin(rct_window* w, rct_widgetindex widgetIndex
|
|||
|
||||
static void input_window_resize_continue(rct_window* w, const ScreenCoordsXY& screenCoords)
|
||||
{
|
||||
if (screenCoords.y < (int32_t)context_get_height() - 2)
|
||||
if (screenCoords.y < static_cast<int32_t>(context_get_height()) - 2)
|
||||
{
|
||||
auto differentialCoords = screenCoords - gInputDragLast;
|
||||
int32_t targetWidth = _originalWindowWidth + differentialCoords.x - w->width;
|
||||
|
@ -1482,7 +1482,7 @@ static void input_update_tooltip(rct_window* w, rct_widgetindex widgetIndex, con
|
|||
*/
|
||||
int32_t get_next_key()
|
||||
{
|
||||
uint8_t* keysPressed = (uint8_t*)context_get_keys_pressed();
|
||||
uint8_t* keysPressed = const_cast<uint8_t*>(context_get_keys_pressed());
|
||||
for (int32_t i = 0; i < 221; i++)
|
||||
{
|
||||
if (keysPressed[i])
|
||||
|
|
Loading…
Reference in New Issue