diff --git a/Source/Core/VideoCommon/NetPlayChatUI.cpp b/Source/Core/VideoCommon/NetPlayChatUI.cpp index 7587229ee0..a84c26d8d7 100644 --- a/Source/Core/VideoCommon/NetPlayChatUI.cpp +++ b/Source/Core/VideoCommon/NetPlayChatUI.cpp @@ -14,10 +14,12 @@ constexpr size_t MAX_BACKLOG_SIZE = 100; std::unique_ptr g_netplay_chat_ui; NetPlayChatUI::NetPlayChatUI(std::function callback) + : m_message_callback{std::move(callback)} { - m_message_callback = std::move(callback); } +NetPlayChatUI::~NetPlayChatUI() = default; + void NetPlayChatUI::Display() { const float scale = ImGui::GetIO().DisplayFramebufferScale.x; @@ -78,12 +80,12 @@ void NetPlayChatUI::Display() ImGui::End(); } -void NetPlayChatUI::AppendChat(const std::string& message, NetPlayChatUI::Color color) +void NetPlayChatUI::AppendChat(std::string message, Color color) { if (m_messages.size() > MAX_BACKLOG_SIZE) m_messages.pop_front(); - m_messages.push_back({message, color}); + m_messages.emplace_back(std::move(message), color); // Only scroll to bottom, if we were at the bottom previously if (m_is_scrolled_to_bottom) @@ -106,7 +108,7 @@ void NetPlayChatUI::SendMessage() void NetPlayChatUI::Activate() { if (ImGui::IsItemFocused()) - ImGui::SetWindowFocus(NULL); + ImGui::SetWindowFocus(nullptr); else m_activate = true; } diff --git a/Source/Core/VideoCommon/NetPlayChatUI.h b/Source/Core/VideoCommon/NetPlayChatUI.h index baef71329b..c995db5c50 100644 --- a/Source/Core/VideoCommon/NetPlayChatUI.h +++ b/Source/Core/VideoCommon/NetPlayChatUI.h @@ -15,12 +15,12 @@ class NetPlayChatUI { public: explicit NetPlayChatUI(std::function callback); - ~NetPlayChatUI() = default; + ~NetPlayChatUI(); using Color = std::array; void Display(); - void AppendChat(const std::string& message, Color color); + void AppendChat(std::string message, Color color); void SendMessage(); void Activate(); diff --git a/Source/Core/VideoCommon/NetPlayGolfUI.cpp b/Source/Core/VideoCommon/NetPlayGolfUI.cpp index 3a831b1cf1..fe67f9a63f 100644 --- a/Source/Core/VideoCommon/NetPlayGolfUI.cpp +++ b/Source/Core/VideoCommon/NetPlayGolfUI.cpp @@ -16,10 +16,12 @@ constexpr float DEFAULT_WINDOW_HEIGHT = 45.0f; std::unique_ptr g_netplay_golf_ui; NetPlayGolfUI::NetPlayGolfUI(std::shared_ptr netplay_client) + : m_netplay_client{netplay_client} { - m_netplay_client = netplay_client; } +NetPlayGolfUI::~NetPlayGolfUI() = default; + void NetPlayGolfUI::Display() { auto client = m_netplay_client.lock(); diff --git a/Source/Core/VideoCommon/NetPlayGolfUI.h b/Source/Core/VideoCommon/NetPlayGolfUI.h index 097c6cf600..461d7fab2f 100644 --- a/Source/Core/VideoCommon/NetPlayGolfUI.h +++ b/Source/Core/VideoCommon/NetPlayGolfUI.h @@ -5,7 +5,6 @@ #pragma once #include -#include namespace NetPlay { @@ -16,7 +15,7 @@ class NetPlayGolfUI { public: explicit NetPlayGolfUI(std::shared_ptr netplay_client); - ~NetPlayGolfUI() = default; + ~NetPlayGolfUI(); void Display();