summaryrefslogtreecommitdiff
path: root/src/video/sdl_v.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-06-30 12:36:24 +0000
committerrubidium <rubidium@openttd.org>2009-06-30 12:36:24 +0000
commit791187cd12e0f784925c593d6ddc3e46c3f5ce1d (patch)
treeb201edfa251498d4b578054d771710f61ada5fad /src/video/sdl_v.cpp
parent414b719b0390bdd7b38090826e285aa1f4772207 (diff)
downloadopenttd-791187cd12e0f784925c593d6ddc3e46c3f5ce1d.tar.xz
(svn r16699) -Fix [FS#3001]: if SDL fails to allocate a surface due to it being too large (and SDL doesn't crash!) fall back to another video driver.
Diffstat (limited to 'src/video/sdl_v.cpp')
-rw-r--r--src/video/sdl_v.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/video/sdl_v.cpp b/src/video/sdl_v.cpp
index f00ab10bc..0592803e5 100644
--- a/src/video/sdl_v.cpp
+++ b/src/video/sdl_v.cpp
@@ -426,11 +426,14 @@ const char *VideoDriver_SDL::Start(const char * const *parm)
const char *s = SdlOpen(SDL_INIT_VIDEO);
if (s != NULL) return s;
+ GetVideoModes();
+ if (!CreateMainSurface(_cur_resolution.width, _cur_resolution.height)) {
+ return SDL_CALL SDL_GetError();
+ }
+
SDL_CALL SDL_VideoDriverName(buf, 30);
DEBUG(driver, 1, "SDL: using driver '%s'", buf);
- GetVideoModes();
- CreateMainSurface(_cur_resolution.width, _cur_resolution.height);
MarkWholeScreenDirty();
SDL_CALL SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);