From: Holger Schemel Date: Fri, 1 Apr 2016 15:29:18 +0000 (+0200) Subject: cleanup of warning messages if setting up SDL 1.2 video mode failed X-Git-Tag: 4.0.0.0-rc1~23 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=45bb92ec36ed15857f404ddd1229d0ef387ddc00;p=rocksndiamonds.git cleanup of warning messages if setting up SDL 1.2 video mode failed --- diff --git a/src/libgame/sdl.c b/src/libgame/sdl.c index 8afeb35b..9db8347b 100644 --- a/src/libgame/sdl.c +++ b/src/libgame/sdl.c @@ -558,8 +558,7 @@ static SDL_Surface *SDLCreateScreen(DrawBuffer **backbuffer, new_surface = SDL_CreateRGBSurface(0, width, height, 32, 0,0,0, 0); if (new_surface == NULL) - Error(ERR_WARN, "SDL_CreateRGBSurface() failed: %s", - SDL_GetError()); + Error(ERR_WARN, "SDL_CreateRGBSurface() failed: %s", SDL_GetError()); } else { @@ -578,6 +577,9 @@ static SDL_Surface *SDLCreateScreen(DrawBuffer **backbuffer, #else new_surface = SDL_SetVideoMode(width, height, video.depth, surface_flags); + + if (new_surface == NULL) + Error(ERR_WARN, "SDL_SetVideoMode() failed: %s", SDL_GetError()); #endif #if defined(TARGET_SDL2) @@ -610,10 +612,7 @@ boolean SDLSetVideoMode(DrawBuffer **backbuffer, boolean fullscreen) if (new_surface == NULL) { - /* switching display to fullscreen mode failed */ - Error(ERR_WARN, "SDL_SetVideoMode() failed: %s", SDL_GetError()); - - /* do not try it again */ + /* switching display to fullscreen mode failed -- do not try it again */ video.fullscreen_available = FALSE; success = FALSE; @@ -636,7 +635,6 @@ boolean SDLSetVideoMode(DrawBuffer **backbuffer, boolean fullscreen) if (new_surface == NULL) { /* switching display to window mode failed -- should not happen */ - Error(ERR_WARN, "SDL_SetVideoMode() failed: %s", SDL_GetError()); success = FALSE; }