* Fixed a bug that changing player type started unwanted cascading change loop that needed longer time to resolve.

This commit is contained in:
LevelX2 2014-11-01 01:57:26 +01:00
parent 1396760d5e
commit 2a2c593dd8

View file

@ -80,6 +80,8 @@ public class NewTournamentDialog extends MageDialog {
private final int CONSTRUCTION_TIME_MIN = 6;
private final int CONSTRUCTION_TIME_MAX = 30;
private boolean automaticChange = false;
/** Creates new form NewTournamentDialog */
public NewTournamentDialog() {
initComponents();
@ -728,8 +730,10 @@ public class NewTournamentDialog extends MageDialog {
panel.getPlayerType().addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
if (!automaticChange) {
playerActionPerformed(evt);
}
}
});
}
this.pack();
@ -740,6 +744,7 @@ public class NewTournamentDialog extends MageDialog {
private void playerActionPerformed(java.awt.event.ActionEvent evt) {
boolean start = false;
int selectedIndex = 0;
automaticChange = true;
for (TournamentPlayerPanel player: players) {
if (!start) {
if (evt.getSource().equals(player.getPlayerType())) {
@ -751,6 +756,7 @@ public class NewTournamentDialog extends MageDialog {
player.getPlayerType().setSelectedIndex(selectedIndex);
}
}
automaticChange = false;
}