diff options
author | rubidium <rubidium@openttd.org> | 2009-06-30 12:36:24 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-06-30 12:36:24 +0000 |
commit | 791187cd12e0f784925c593d6ddc3e46c3f5ce1d (patch) | |
tree | b201edfa251498d4b578054d771710f61ada5fad | |
parent | 414b719b0390bdd7b38090826e285aa1f4772207 (diff) | |
download | openttd-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.
-rw-r--r-- | src/video/sdl_v.cpp | 7 |
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); |