diff --git a/src/openrct2-ui/UiContext.Win32.cpp b/src/openrct2-ui/UiContext.Win32.cpp index 8a377b5eec..2d7afc879a 100644 --- a/src/openrct2-ui/UiContext.Win32.cpp +++ b/src/openrct2-ui/UiContext.Win32.cpp @@ -232,7 +232,7 @@ namespace OpenRCT2::Ui return result; } - static std::wstring GetFilterString(const std::vector filters) + static std::wstring GetFilterString(const std::vector& filters) { std::wstringstream filtersb; for (const auto& filter : filters) diff --git a/src/openrct2-ui/UiContext.cpp b/src/openrct2-ui/UiContext.cpp index 7e7c1aa22c..9031f447a1 100644 --- a/src/openrct2-ui/UiContext.cpp +++ b/src/openrct2-ui/UiContext.cpp @@ -123,7 +123,7 @@ public: ~UiContext() override { - CloseWindow(); + UiContext::CloseWindow(); delete _windowManager; SDL_QuitSubSystem(SDL_INIT_VIDEO); delete _platformUiContext; @@ -179,11 +179,8 @@ public: if (mode == FULLSCREEN_MODE::FULLSCREEN) { SDL_SetWindowFullscreen(_window, 0); - } - // Set window size - if (mode == FULLSCREEN_MODE::FULLSCREEN) - { + // Set window size UpdateFullscreenResolutions(); Resolution resolution = GetClosestResolution(gConfigGeneral.fullscreen_width, gConfigGeneral.fullscreen_height); SDL_SetWindowSize(_window, resolution.Width, resolution.Height); @@ -598,7 +595,7 @@ public: { scaleQuality = ScaleQuality::Linear; } - snprintf(scaleQualityBuffer, sizeof(scaleQualityBuffer), "%u", static_cast(scaleQuality)); + snprintf(scaleQualityBuffer, sizeof(scaleQualityBuffer), "%d", static_cast(scaleQuality)); SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, scaleQualityBuffer); int32_t width, height; diff --git a/src/openrct2-ui/audio/AudioChannel.cpp b/src/openrct2-ui/audio/AudioChannel.cpp index 8a356f1904..ad4875f4c2 100644 --- a/src/openrct2-ui/audio/AudioChannel.cpp +++ b/src/openrct2-ui/audio/AudioChannel.cpp @@ -47,9 +47,9 @@ namespace OpenRCT2::Audio public: AudioChannelImpl() { - SetRate(1); - SetVolume(MIXER_VOLUME_MAX); - SetPan(0.5f); + AudioChannelImpl::SetRate(1); + AudioChannelImpl::SetVolume(MIXER_VOLUME_MAX); + AudioChannelImpl::SetPan(0.5f); } ~AudioChannelImpl() override diff --git a/src/openrct2-ui/audio/AudioMixer.cpp b/src/openrct2-ui/audio/AudioMixer.cpp index 0da4428bbf..3af92b91f7 100644 --- a/src/openrct2-ui/audio/AudioMixer.cpp +++ b/src/openrct2-ui/audio/AudioMixer.cpp @@ -56,7 +56,7 @@ namespace OpenRCT2::Audio ~AudioMixerImpl() override { - Close(); + AudioMixerImpl::Close(); delete _nullSource; } diff --git a/src/openrct2-ui/drawing/engines/HardwareDisplayDrawingEngine.cpp b/src/openrct2-ui/drawing/engines/HardwareDisplayDrawingEngine.cpp index 8f0325938a..5fb9e20136 100644 --- a/src/openrct2-ui/drawing/engines/HardwareDisplayDrawingEngine.cpp +++ b/src/openrct2-ui/drawing/engines/HardwareDisplayDrawingEngine.cpp @@ -134,7 +134,7 @@ public: } char scaleQualityBuffer[4]; - snprintf(scaleQualityBuffer, sizeof(scaleQualityBuffer), "%u", static_cast(scaleQuality)); + snprintf(scaleQualityBuffer, sizeof(scaleQualityBuffer), "%d", static_cast(scaleQuality)); SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "0"); _screenTexture = SDL_CreateTexture(_sdlRenderer, pixelFormat, SDL_TEXTUREACCESS_STREAMING, width, height); SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, scaleQualityBuffer); diff --git a/src/openrct2-ui/drawing/engines/opengl/OpenGLShaderProgram.cpp b/src/openrct2-ui/drawing/engines/opengl/OpenGLShaderProgram.cpp index 2056a13a18..a56ce93c62 100644 --- a/src/openrct2-ui/drawing/engines/opengl/OpenGLShaderProgram.cpp +++ b/src/openrct2-ui/drawing/engines/opengl/OpenGLShaderProgram.cpp @@ -21,9 +21,8 @@ using namespace OpenRCT2; OpenGLShader::OpenGLShader(const char* name, GLenum type) + : _type(type) { - _type = type; - auto path = GetPath(name); auto sourceCode = ReadSourceCode(path); auto sourceCodeStr = sourceCode.c_str(); diff --git a/src/openrct2-ui/drawing/engines/opengl/TextureCache.h b/src/openrct2-ui/drawing/engines/opengl/TextureCache.h index 9c0125b0b7..f624da0df7 100644 --- a/src/openrct2-ui/drawing/engines/opengl/TextureCache.h +++ b/src/openrct2-ui/drawing/engines/opengl/TextureCache.h @@ -91,9 +91,9 @@ private: public: Atlas(GLuint index, int32_t imageSize) + : _index(index) + , _imageSize(imageSize) { - _index = index; - _imageSize = imageSize; } void Initialise(int32_t atlasWidth, int32_t atlasHeight) diff --git a/src/openrct2-ui/windows/LoadSave.cpp b/src/openrct2-ui/windows/LoadSave.cpp index ba4c410571..74585956a9 100644 --- a/src/openrct2-ui/windows/LoadSave.cpp +++ b/src/openrct2-ui/windows/LoadSave.cpp @@ -117,13 +117,13 @@ enum struct LoadSaveListItem { - std::string name; - std::string path; - time_t date_modified; - std::string date_formatted; - std::string time_formatted; - uint8_t type; - bool loaded; + std::string name{}; + std::string path{}; + time_t date_modified{ 0 }; + std::string date_formatted{}; + std::string time_formatted{}; + uint8_t type{ 0 }; + bool loaded{ false }; }; static std::function _loadSaveCallback; diff --git a/src/openrct2-ui/windows/ObjectLoadError.cpp b/src/openrct2-ui/windows/ObjectLoadError.cpp index a608cf8aeb..ed1b1e70a0 100644 --- a/src/openrct2-ui/windows/ObjectLoadError.cpp +++ b/src/openrct2-ui/windows/ObjectLoadError.cpp @@ -150,7 +150,7 @@ private: _nextDownloadQueued = true; } - void DownloadObject(const rct_object_entry& entry, const std::string name, const std::string url) + void DownloadObject(const rct_object_entry& entry, const std::string& name, const std::string& url) { try { diff --git a/src/openrct2/network/Socket.cpp b/src/openrct2/network/Socket.cpp index 2bf4d8dd30..73bca48b76 100644 --- a/src/openrct2/network/Socket.cpp +++ b/src/openrct2/network/Socket.cpp @@ -631,11 +631,11 @@ public: private: explicit TcpSocket(SOCKET socket, const std::string& hostName, const std::string& ipAddress) + : _status(SocketStatus::Connected) + , _socket(socket) + , _ipAddress(ipAddress) + , _hostName(hostName) { - _socket = socket; - _hostName = hostName; - _ipAddress = ipAddress; - _status = SocketStatus::Connected; } void CloseSocket() @@ -833,10 +833,10 @@ public: private: explicit UdpSocket(SOCKET socket, const std::string& hostName) + : _status(SocketStatus::Connected) + , _socket(socket) + , _hostName(hostName) { - _socket = socket; - _hostName = hostName; - _status = SocketStatus::Connected; } SOCKET CreateSocket() diff --git a/test/tests/AssertHelpers.hpp b/test/tests/AssertHelpers.hpp index 07f5213946..46398badcf 100644 --- a/test/tests/AssertHelpers.hpp +++ b/test/tests/AssertHelpers.hpp @@ -13,7 +13,7 @@ #include #include -template static void AssertVector(std::vector actual, TExpected expected) +template static void AssertVector(const std::vector& actual, TExpected expected) { ASSERT_EQ(actual.size(), expected.size()) << "Expected vector of size " << expected.size() << ", but was " << actual.size(); size_t i = 0; @@ -24,7 +24,7 @@ template static void AssertVector(std::vector } } -template static void AssertVector(std::vector actual, std::initializer_list expected) +template static void AssertVector(const std::vector& actual, std::initializer_list expected) { AssertVector>(actual, expected); }