diff options
author | Michael Lutz <michi@icosahedron.de> | 2020-05-17 23:32:08 +0200 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2020-05-21 20:02:34 +0200 |
commit | 37bc2f806462b3c2a84891b3aad6db00e935da86 (patch) | |
tree | 9f832e8646ec0c4a4038f6c0642c853fbe02038a /src/video | |
parent | a49fdb7ebbb8d8ce96bcd7bd779b18bcd86d0643 (diff) | |
download | openttd-37bc2f806462b3c2a84891b3aad6db00e935da86.tar.xz |
Codechange: Use std::string in the driver and blitter selection code.
Diffstat (limited to 'src/video')
-rw-r--r-- | src/video/allegro_v.cpp | 2 | ||||
-rw-r--r-- | src/video/allegro_v.h | 2 | ||||
-rw-r--r-- | src/video/cocoa/cocoa_v.h | 2 | ||||
-rw-r--r-- | src/video/cocoa/cocoa_v.mm | 4 | ||||
-rw-r--r-- | src/video/dedicated_v.cpp | 2 | ||||
-rw-r--r-- | src/video/dedicated_v.h | 2 | ||||
-rw-r--r-- | src/video/null_v.cpp | 2 | ||||
-rw-r--r-- | src/video/null_v.h | 2 | ||||
-rw-r--r-- | src/video/sdl2_v.cpp | 4 | ||||
-rw-r--r-- | src/video/sdl2_v.h | 2 | ||||
-rw-r--r-- | src/video/sdl_v.cpp | 4 | ||||
-rw-r--r-- | src/video/sdl_v.h | 2 | ||||
-rw-r--r-- | src/video/video_driver.hpp | 2 | ||||
-rw-r--r-- | src/video/win32_v.cpp | 4 | ||||
-rw-r--r-- | src/video/win32_v.h | 2 |
15 files changed, 19 insertions, 19 deletions
diff --git a/src/video/allegro_v.cpp b/src/video/allegro_v.cpp index 88e5c528f..9b0bef1ac 100644 --- a/src/video/allegro_v.cpp +++ b/src/video/allegro_v.cpp @@ -410,7 +410,7 @@ static void PollEvent() */ int _allegro_instance_count = 0; -const char *VideoDriver_Allegro::Start(const char * const *parm) +const char *VideoDriver_Allegro::Start(const StringList &parm) { if (_allegro_instance_count == 0 && install_allegro(SYSTEM_AUTODETECT, &errno, nullptr)) { DEBUG(driver, 0, "allegro: install_allegro failed '%s'", allegro_error); diff --git a/src/video/allegro_v.h b/src/video/allegro_v.h index fb7b84ee2..641e3d6c2 100644 --- a/src/video/allegro_v.h +++ b/src/video/allegro_v.h @@ -15,7 +15,7 @@ /** The allegro video driver. */ class VideoDriver_Allegro : public VideoDriver { public: - const char *Start(const char * const *param) override; + const char *Start(const StringList ¶m) override; void Stop() override; diff --git a/src/video/cocoa/cocoa_v.h b/src/video/cocoa/cocoa_v.h index 7286c685b..3da6848d0 100644 --- a/src/video/cocoa/cocoa_v.h +++ b/src/video/cocoa/cocoa_v.h @@ -14,7 +14,7 @@ class VideoDriver_Cocoa : public VideoDriver { public: - const char *Start(const char * const *param) override; + const char *Start(const StringList ¶m) override; /** Stop the video driver */ void Stop() override; diff --git a/src/video/cocoa/cocoa_v.mm b/src/video/cocoa/cocoa_v.mm index 13a9cc9c4..10f30027b 100644 --- a/src/video/cocoa/cocoa_v.mm +++ b/src/video/cocoa/cocoa_v.mm @@ -396,7 +396,7 @@ void VideoDriver_Cocoa::Stop() /** * Initialize a cocoa video subdriver. */ -const char *VideoDriver_Cocoa::Start(const char * const *parm) +const char *VideoDriver_Cocoa::Start(const StringList &parm) { if (!MacOSVersionIsAtLeast(10, 6, 0)) return "The Cocoa video driver requires Mac OS X 10.6 or later."; @@ -520,7 +520,7 @@ void CocoaDialog(const char *title, const char *message, const char *buttonLabel bool wasstarted = _cocoa_video_started; if (VideoDriver::GetInstance() == NULL) { setupApplication(); // Setup application before showing dialog - } else if (!_cocoa_video_started && VideoDriver::GetInstance()->Start(NULL) != NULL) { + } else if (!_cocoa_video_started && VideoDriver::GetInstance()->Start(StringList()) != NULL) { fprintf(stderr, "%s: %s\n", title, message); return; } diff --git a/src/video/dedicated_v.cpp b/src/video/dedicated_v.cpp index ac7d38bb7..0089d163d 100644 --- a/src/video/dedicated_v.cpp +++ b/src/video/dedicated_v.cpp @@ -133,7 +133,7 @@ extern bool SafeLoad(const char *filename, SaveLoadOperation fop, DetailedFileTy static FVideoDriver_Dedicated iFVideoDriver_Dedicated; -const char *VideoDriver_Dedicated::Start(const char * const *parm) +const char *VideoDriver_Dedicated::Start(const StringList &parm) { int bpp = BlitterFactory::GetCurrentBlitter()->GetScreenDepth(); _dedicated_video_mem = (bpp == 0) ? nullptr : MallocT<byte>(_cur_resolution.width * _cur_resolution.height * (bpp / 8)); diff --git a/src/video/dedicated_v.h b/src/video/dedicated_v.h index 27401aae9..54e2dd402 100644 --- a/src/video/dedicated_v.h +++ b/src/video/dedicated_v.h @@ -15,7 +15,7 @@ /** The dedicated server video driver. */ class VideoDriver_Dedicated : public VideoDriver { public: - const char *Start(const char * const *param) override; + const char *Start(const StringList ¶m) override; void Stop() override; diff --git a/src/video/null_v.cpp b/src/video/null_v.cpp index 3e98ea925..2fa45e1bc 100644 --- a/src/video/null_v.cpp +++ b/src/video/null_v.cpp @@ -17,7 +17,7 @@ /** Factory for the null video driver. */ static FVideoDriver_Null iFVideoDriver_Null; -const char *VideoDriver_Null::Start(const char * const *parm) +const char *VideoDriver_Null::Start(const StringList &parm) { #ifdef _MSC_VER /* Disable the MSVC assertion message box. */ diff --git a/src/video/null_v.h b/src/video/null_v.h index ed563bffb..ee83de7e6 100644 --- a/src/video/null_v.h +++ b/src/video/null_v.h @@ -18,7 +18,7 @@ private: uint ticks; ///< Amount of ticks to run. public: - const char *Start(const char * const *param) override; + const char *Start(const StringList ¶m) override; void Stop() override; diff --git a/src/video/sdl2_v.cpp b/src/video/sdl2_v.cpp index 0b3b9b8e3..0442a0e87 100644 --- a/src/video/sdl2_v.cpp +++ b/src/video/sdl2_v.cpp @@ -626,7 +626,7 @@ int VideoDriver_SDL::PollEvent() return -1; } -const char *VideoDriver_SDL::Start(const char * const *parm) +const char *VideoDriver_SDL::Start(const StringList &parm) { /* Explicitly disable hardware acceleration. Enabling this causes * UpdateWindowSurface() to update the window's texture instead of @@ -652,7 +652,7 @@ const char *VideoDriver_SDL::Start(const char * const *parm) MarkWholeScreenDirty(); - _draw_threaded = GetDriverParam(parm, "no_threads") == nullptr && GetDriverParam(parm, "no_thread") == nullptr; + _draw_threaded = !GetDriverParamBool(parm, "no_threads") && !GetDriverParamBool(parm, "no_thread"); SDL_StopTextInput(); this->edit_box_focused = false; diff --git a/src/video/sdl2_v.h b/src/video/sdl2_v.h index ae456a39d..80d4018a7 100644 --- a/src/video/sdl2_v.h +++ b/src/video/sdl2_v.h @@ -15,7 +15,7 @@ /** The SDL video driver. */ class VideoDriver_SDL : public VideoDriver { public: - const char *Start(const char * const *param) override; + const char *Start(const StringList ¶m) override; void Stop() override; diff --git a/src/video/sdl_v.cpp b/src/video/sdl_v.cpp index aacd3f2cb..fba6166c9 100644 --- a/src/video/sdl_v.cpp +++ b/src/video/sdl_v.cpp @@ -596,7 +596,7 @@ int VideoDriver_SDL::PollEvent() return -1; } -const char *VideoDriver_SDL::Start(const char * const *parm) +const char *VideoDriver_SDL::Start(const StringList &parm) { char buf[30]; _use_hwpalette = GetDriverParamInt(parm, "hw_palette", 2); @@ -623,7 +623,7 @@ const char *VideoDriver_SDL::Start(const char * const *parm) MarkWholeScreenDirty(); SetupKeyboard(); - _draw_threaded = GetDriverParam(parm, "no_threads") == nullptr && GetDriverParam(parm, "no_thread") == nullptr; + _draw_threaded = !GetDriverParamBool(parm, "no_threads") && !GetDriverParamBool(parm, "no_thread"); return nullptr; } diff --git a/src/video/sdl_v.h b/src/video/sdl_v.h index 39c77e5d3..ffebd041e 100644 --- a/src/video/sdl_v.h +++ b/src/video/sdl_v.h @@ -15,7 +15,7 @@ /** The SDL video driver. */ class VideoDriver_SDL : public VideoDriver { public: - const char *Start(const char * const *param) override; + const char *Start(const StringList ¶m) override; void Stop() override; diff --git a/src/video/video_driver.hpp b/src/video/video_driver.hpp index 2cca66d3b..15dd5d0d4 100644 --- a/src/video/video_driver.hpp +++ b/src/video/video_driver.hpp @@ -104,7 +104,7 @@ public: } }; -extern char *_ini_videodriver; +extern std::string _ini_videodriver; extern std::vector<Dimension> _resolutions; extern Dimension _cur_resolution; extern bool _rightclick_emulate; diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp index 3deb0beb0..341187320 100644 --- a/src/video/win32_v.cpp +++ b/src/video/win32_v.cpp @@ -1111,7 +1111,7 @@ static void FindResolutions() static FVideoDriver_Win32 iFVideoDriver_Win32; -const char *VideoDriver_Win32::Start(const char * const *parm) +const char *VideoDriver_Win32::Start(const StringList &parm) { memset(&_wnd, 0, sizeof(_wnd)); @@ -1132,7 +1132,7 @@ const char *VideoDriver_Win32::Start(const char * const *parm) MarkWholeScreenDirty(); - _draw_threaded = GetDriverParam(parm, "no_threads") == nullptr && GetDriverParam(parm, "no_thread") == nullptr && std::thread::hardware_concurrency() > 1; + _draw_threaded = !GetDriverParamBool(parm, "no_threads") && !GetDriverParamBool(parm, "no_thread") && std::thread::hardware_concurrency() > 1; return nullptr; } diff --git a/src/video/win32_v.h b/src/video/win32_v.h index a0b5c7e16..5c1b20322 100644 --- a/src/video/win32_v.h +++ b/src/video/win32_v.h @@ -15,7 +15,7 @@ /** The video driver for windows. */ class VideoDriver_Win32 : public VideoDriver { public: - const char *Start(const char * const *param) override; + const char *Start(const StringList ¶m) override; void Stop() override; |