From: Ryan C. Gordon Date: Wed, 19 Aug 2009 04:40:29 +0000 (-0400) Subject: Fixed buffer overrun (misunderstanding about input system). X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=ad33c033d12e3b0b2b2cc0c8520f241f86cef060;p=lugaru.git Fixed buffer overrun (misunderstanding about input system). --- diff --git a/Source/OpenGL_Windows.cpp b/Source/OpenGL_Windows.cpp index 1588b64..f42de33 100644 --- a/Source/OpenGL_Windows.cpp +++ b/Source/OpenGL_Windows.cpp @@ -468,17 +468,10 @@ static void sdlEventProc(const SDL_Event &e, Game &game) case SDL_MOUSEBUTTONDOWN: { val = clamp_sdl_mouse_button(e.button.button); - if (val >= 0) + if ((val >= 0) && (val <= 2)) { if (val == 0) - { g_button = true; - SetKey(MAC_MOUSEBUTTON1); - } - - else if (val == 1) - SetKey(MAC_MOUSEBUTTON2); - buttons[val] = true; } } @@ -487,17 +480,10 @@ static void sdlEventProc(const SDL_Event &e, Game &game) case SDL_MOUSEBUTTONUP: { val = clamp_sdl_mouse_button(e.button.button); - if (val >= 0) + if ((val >= 0) && (val <= 2)) { if (val == 0) - { g_button = false; - ClearKey(MAC_MOUSEBUTTON1); - } - - else if (val == 1) - ClearKey(MAC_MOUSEBUTTON2); - buttons[val] = false; } }