From f0519efbb525318446a8412ad35f9946e5cb210f Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Fri, 24 Jun 2022 17:03:50 +0200 Subject: [PATCH] Fix SDKLauncher bug Fix bug where SDK Launcher would display duplicate map names if server and client VPK's are installed within the same VPK directory. --- r5dev/sdklauncher/basepanel.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/r5dev/sdklauncher/basepanel.cpp b/r5dev/sdklauncher/basepanel.cpp index 6fadeadf..6a9001fc 100644 --- a/r5dev/sdklauncher/basepanel.cpp +++ b/r5dev/sdklauncher/basepanel.cpp @@ -563,11 +563,16 @@ void CUIBaseSurface::ParseMaps() } else if (strcmp(smRegexMatches[1].str().c_str(), "mp_common") == 0) { - this->m_MapCombo->Items.Add("mp_lobby"); + if (!this->m_MapCombo->Items.Contains("mp_lobby")) + { + this->m_MapCombo->Items.Add("mp_lobby"); + } continue; } - - this->m_MapCombo->Items.Add(smRegexMatches[1].str().c_str()); + else if (!this->m_MapCombo->Items.Contains(smRegexMatches[1].str().c_str())) + { + this->m_MapCombo->Items.Add(smRegexMatches[1].str().c_str()); + } } } } @@ -591,7 +596,10 @@ void CUIBaseSurface::ParsePlaylists() const auto& vcPlaylists = vRoot.childs.at("Playlists"); for (auto [id, it] = std::tuple{ 1, vcPlaylists->childs.begin()}; it != vcPlaylists->childs.end(); id++, it++) { - this->m_PlaylistCombo->Items.Add(it->first.c_str()); + if (!this->m_PlaylistCombo->Items.Contains(it->first.c_str())) + { + this->m_PlaylistCombo->Items.Add(it->first.c_str()); + } } } }