summaryrefslogtreecommitdiff
path: root/src/video
diff options
context:
space:
mode:
authormatthijs <matthijs@openttd.org>2012-02-07 10:12:11 +0000
committermatthijs <matthijs@openttd.org>2012-02-07 10:12:11 +0000
commitcba6390973f27410b5dc32923bc697ed9ff1d2cc (patch)
treee4f44270f7f58e1670579e55b000a537ae76fcee /src/video
parentcf58d5d12cf1d3e90159cd9ee51a8ce0ccfbcb54 (diff)
downloadopenttd-cba6390973f27410b5dc32923bc697ed9ff1d2cc.tar.xz
(svn r23909) -Fix: [SDL] Fix keyboard-related segfault when compiling against SDL 1.3.
Diffstat (limited to 'src/video')
-rw-r--r--src/video/sdl_v.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/video/sdl_v.cpp b/src/video/sdl_v.cpp
index 8996240b3..d22ad512e 100644
--- a/src/video/sdl_v.cpp
+++ b/src/video/sdl_v.cpp
@@ -561,8 +561,12 @@ void VideoDriver_SDL::MainLoop()
#else
/* Speedup when pressing tab, except when using ALT+TAB
* to switch to another application */
+#if SDL_VERSION_ATLEAST(1, 3, 0)
+ if (keys[SDL_SCANCODE_TAB] && (mod & KMOD_ALT) == 0)
+#else
if (keys[SDLK_TAB] && (mod & KMOD_ALT) == 0)
-#endif
+#endif /* SDL_VERSION_ATLEAST(1, 3, 0) */
+#endif /* defined(_DEBUG) */
{
if (!_networking && _game_mode != GM_MENU) _fast_forward |= 2;
} else if (_fast_forward & 2) {
@@ -582,11 +586,17 @@ void VideoDriver_SDL::MainLoop()
/* determine which directional keys are down */
_dirkeys =
+#if SDL_VERSION_ATLEAST(1, 3, 0)
+ (keys[SDL_SCANCODE_LEFT] ? 1 : 0) |
+ (keys[SDL_SCANCODE_UP] ? 2 : 0) |
+ (keys[SDL_SCANCODE_RIGHT] ? 4 : 0) |
+ (keys[SDL_SCANCODE_DOWN] ? 8 : 0);
+#else
(keys[SDLK_LEFT] ? 1 : 0) |
(keys[SDLK_UP] ? 2 : 0) |
(keys[SDLK_RIGHT] ? 4 : 0) |
(keys[SDLK_DOWN] ? 8 : 0);
-
+#endif
if (old_ctrl_pressed != _ctrl_pressed) HandleCtrlChanged();
/* The gameloop is the part that can run asynchroniously. The rest