1
0
Fork 0

Codechange: [SDL2] Only prepare "caption" if you are going to us it

pull/8622/head
Patric Stout 2021-01-16 17:38:43 +01:00 committed by Patric Stout
parent e41ec5b42e
commit 8de325f256
1 changed files with 3 additions and 3 deletions

View File

@ -282,7 +282,6 @@ static uint FindStartupDisplay(uint startup_display)
bool VideoDriver_SDL::CreateMainSurface(uint w, uint h, bool resize) bool VideoDriver_SDL::CreateMainSurface(uint w, uint h, bool resize)
{ {
SDL_Surface *newscreen; SDL_Surface *newscreen;
char caption[50];
int bpp = BlitterFactory::GetCurrentBlitter()->GetScreenDepth(); int bpp = BlitterFactory::GetCurrentBlitter()->GetScreenDepth();
GetAvailableVideoMode(&w, &h); GetAvailableVideoMode(&w, &h);
@ -292,8 +291,6 @@ bool VideoDriver_SDL::CreateMainSurface(uint w, uint h, bool resize)
/* Free any previously allocated shadow surface */ /* Free any previously allocated shadow surface */
if (_sdl_surface != nullptr && _sdl_surface != _sdl_realscreen) SDL_FreeSurface(_sdl_surface); if (_sdl_surface != nullptr && _sdl_surface != _sdl_realscreen) SDL_FreeSurface(_sdl_surface);
seprintf(caption, lastof(caption), "OpenTTD %s", _openttd_revision);
if (_sdl_window == nullptr) { if (_sdl_window == nullptr) {
Uint32 flags = SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE; Uint32 flags = SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE;
@ -307,6 +304,9 @@ bool VideoDriver_SDL::CreateMainSurface(uint w, uint h, bool resize)
x = r.x + std::max(0, r.w - static_cast<int>(w)) / 2; x = r.x + std::max(0, r.w - static_cast<int>(w)) / 2;
y = r.y + std::max(0, r.h - static_cast<int>(h)) / 4; // decent desktops have taskbars at the bottom y = r.y + std::max(0, r.h - static_cast<int>(h)) / 4; // decent desktops have taskbars at the bottom
} }
char caption[50];
seprintf(caption, lastof(caption), "OpenTTD %s", _openttd_revision);
_sdl_window = SDL_CreateWindow( _sdl_window = SDL_CreateWindow(
caption, caption,
x, y, x, y,