mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
* Fixed a bug that changing player type started unwanted cascading change loop that needed longer time to resolve.
This commit is contained in:
parent
1396760d5e
commit
2a2c593dd8
1 changed files with 7 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue