diff options
| author | shuffle2 <godisgovernment@gmail.com> | 2014-05-29 13:52:44 -0700 |
|---|---|---|
| committer | shuffle2 <godisgovernment@gmail.com> | 2014-05-29 13:52:44 -0700 |
| commit | fee69236d5bc25d9d502b9deaf10eeea13b482fa (patch) | |
| tree | de00f75b46dcc61c30c515b8508bc25e1f2a1dc3 /Source/Core | |
| parent | e0edf316086ed9b2180e6789f3d0b095a4c60532 (diff) | |
| parent | b1029223c63bf7ea6eade2a4bba3813160b7e9f5 (diff) | |
Merge pull request #403 from RachelBryk/netplay-player-selection
When updating netplay player list, reselect by string instead of index.
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/DolphinWX/NetWindow.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/Source/Core/DolphinWX/NetWindow.cpp b/Source/Core/DolphinWX/NetWindow.cpp index 4ac4ff7822..daefacb63e 100644 --- a/Source/Core/DolphinWX/NetWindow.cpp +++ b/Source/Core/DolphinWX/NetWindow.cpp @@ -539,14 +539,29 @@ void NetPlayDiag::OnThread(wxCommandEvent& event) std::string tmps; netplay_client->GetPlayerList(tmps, m_playerids); - const int selection = m_player_lbox->GetSelection(); + wxString selection; + if (m_player_lbox->GetSelection() != wxNOT_FOUND) + selection = m_player_lbox->GetString(m_player_lbox->GetSelection()); m_player_lbox->Clear(); std::istringstream ss(tmps); while (std::getline(ss, tmps)) m_player_lbox->Append(StrToWxStr(tmps)); - m_player_lbox->SetSelection(selection); + // remove ping from selection string, in case it has changed + selection.erase(selection.find_last_of("|") + 1); + + if (selection.Length() > 0) + { + for (unsigned int i = 0; i < m_player_lbox->GetCount(); ++i) + { + if (selection == m_player_lbox->GetString(i).Mid(0, selection.Length())) + { + m_player_lbox->SetSelection(i); + break; + } + } + } switch (event.GetId()) { |
