Skip to content

Commit

Permalink
Fixed a bug where player from wrong game is shown if the name is the …
Browse files Browse the repository at this point in the history
…same + optimisations
  • Loading branch information
dRoskar committed Jan 21, 2015
1 parent e218132 commit a2bf4ea
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion BGCRanker/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ private void readData(String newGame)
// reset collected data
games.Clear();
players.Clear();
gameNames.Clear();

// get games
String[] gameDirectories = Directory.GetDirectories(dataPath);
Expand Down Expand Up @@ -162,6 +163,7 @@ private void readData(String newGame)

player.Victories = 0;
player.VictoriesOld = 0;
player.HasPrev = false;
}
else
{
Expand Down Expand Up @@ -242,6 +244,7 @@ public void comboSelectionChanged(String selectPlayer)
if (game.Name == (String) gamesComboBox.SelectedItem)
{
selectedGame = game;
break;
}
}

Expand Down Expand Up @@ -308,9 +311,10 @@ private void playersListBox_SelectionChanged(object sender, SelectionChangedEven
selectedPlayer = null;
foreach (Player player in players)
{
if (player.Name == playersListBox.SelectedItem.ToString())
if (player.Name == playersListBox.SelectedItem.ToString() && player.Game == selectedGame.Name)
{
selectedPlayer = player;
break;
}
}

Expand Down

0 comments on commit a2bf4ea

Please sign in to comment.