summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2021-01-16 17:38:43 +0100
committerPatric Stout <github@truebrain.nl>2021-01-30 21:43:59 +0100
commit8de325f2567bd47ed6546a15c084449d4f585f3e (patch)
tree95807cdf20e7a1adc5a6fbc04a195bb1d175c14f /src
parente41ec5b42eef7121f07a802178855b3854d857ee (diff)
downloadopenttd-8de325f2567bd47ed6546a15c084449d4f585f3e.tar.xz
Codechange: [SDL2] Only prepare "caption" if you are going to us it
Diffstat (limited to 'src')
-rw-r--r--src/video/sdl2_v.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/video/sdl2_v.cpp b/src/video/sdl2_v.cpp
index ce1917ccc..33c2b96b1 100644
--- a/src/video/sdl2_v.cpp
+++ b/src/video/sdl2_v.cpp
@@ -282,7 +282,6 @@ static uint FindStartupDisplay(uint startup_display)
bool VideoDriver_SDL::CreateMainSurface(uint w, uint h, bool resize)
{
SDL_Surface *newscreen;
- char caption[50];
int bpp = BlitterFactory::GetCurrentBlitter()->GetScreenDepth();
GetAvailableVideoMode(&w, &h);
@@ -292,8 +291,6 @@ bool VideoDriver_SDL::CreateMainSurface(uint w, uint h, bool resize)
/* Free any previously allocated shadow 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) {
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;
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(
caption,
x, y,