Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #403 from RachelBryk/netplay-player-selection
When updating netplay player list, reselect by string instead of index.
  • Loading branch information
shuffle2 committed May 29, 2014
2 parents e0edf31 + b102922 commit fee6923
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions Source/Core/DolphinWX/NetWindow.cpp
Expand Up @@ -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())
{
Expand Down

0 comments on commit fee6923

Please sign in to comment.