Client memory need - Removed some unneeded references.

This commit is contained in:
LevelX2 2014-02-13 17:12:02 +01:00
parent 67e25d43bd
commit 6646aaf5b2
3 changed files with 19 additions and 6 deletions

View file

@ -36,7 +36,6 @@ import mage.constants.ColoredManaSymbol;
import mage.constants.Rarity;
import mage.interfaces.rate.RateCallback;
import mage.utils.DeckBuilder;
import mage.view.TournamentTypeView;
/**
@ -156,16 +155,28 @@ public class DeckGenerator {
tmp.createNewFile();
deck.setName("Generated-Deck-" + UUID.randomUUID());
Sets.saveDeck(tmp.getAbsolutePath(), deck.getDeckCardLists());
deck = null;
//JOptionPane.showMessageDialog(null, "Deck has been generated.");
DeckGenerator.cleanUp(btnGenerate, btnCancel);
return tmp.getAbsolutePath();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Couldn't generate deck. Try once again.");
JOptionPane.showMessageDialog(null, "Couldn't generate deck. Try again.");
}
}
DeckGenerator.cleanUp(btnGenerate, btnCancel);
return selectedColors;
}
private static void cleanUp(JButton btnGenerate, JButton btnCancel) {
for (ActionListener al: btnGenerate.getActionListeners()) {
btnGenerate.removeActionListener(al);
}
for (ActionListener al: btnCancel.getActionListeners()) {
btnCancel.removeActionListener(al);
}
deck = null;
}
/**
* Generates card pool
*/

View file

@ -48,7 +48,7 @@ import mage.client.util.Config;
*/
public class NewPlayerPanel extends javax.swing.JPanel {
private JFileChooser fcSelectDeck;
private final JFileChooser fcSelectDeck;
/** Creates new form NewPlayerPanel */
public NewPlayerPanel() {

View file

@ -27,7 +27,7 @@ public class DeckBuilder {
private static final int DECK_COST[] = {1, 2, 3, 4, 6, 10};
private static final int MIN_CARD_SCORE = 25;
private static final int MIN_SOURCE = 3; // minmal number of sources for a mana color, will be taken also if ratio would give a lower number
private static Deck deck = new Deck();
private static Deck deck;
private static int deckCount[];
private static int deckSize;
@ -86,7 +86,9 @@ public class DeckBuilder {
addCardsToDeck(remainingCards, 5, 10, deckSpells - deck.getCards().size());
addLandsToDeck(allowedColors, setsToUse, landCardPool, callback);
return deck;
Deck returnedDeck = deck;
deck = null;
return returnedDeck;
}
/**