master
beholder 2011-10-01 06:19:06 +02:00
commit a0858d44e8
6 changed files with 19 additions and 8 deletions

View File

@ -23,4 +23,5 @@ public interface CardImagesProvider {
final int index,
final boolean high);
void clearCache();
}

View File

@ -71,4 +71,9 @@ public class HighQualityCardImagesProvider implements CardImagesProvider {
public static CardImagesProvider getInstance() {
return INSTANCE;
}
public void clearCache() {
origImages.clear();
scaledImages.clear();
}
}

View File

@ -1,6 +1,7 @@
package magic.test;
import magic.ai.MCTSAI;
import magic.ai.MagicAIImpl;
import magic.ai.MagicAI;
import magic.model.MagicGame;
import magic.model.MagicPlayer;
@ -19,7 +20,7 @@ class TestMCTS extends TestGameBuilder {
final MagicPlayerDefinition player2=new MagicPlayerDefinition("Computer",true,profile,14);
tournament.setPlayers(new MagicPlayerDefinition[]{player1,player2});
tournament.setStartPlayer(0);
tournament.setAIs(new MagicAI[]{null, new MCTSAI(true, true)});
tournament.setAIs(new MagicAI[]{null, MagicAIImpl.MCTS.getAI()});
final MagicGame game=tournament.nextGame(true);
game.setPhase(MagicMainPhase.getFirstInstance());

View File

@ -1,7 +1,7 @@
package magic.test;
import magic.ai.MCTSAI;
import magic.ai.MagicAI;
import magic.ai.MagicAIImpl;
import magic.model.MagicGame;
import magic.model.MagicPlayer;
import magic.model.MagicPlayerDefinition;
@ -19,7 +19,7 @@ class TestMCTSCrash extends TestGameBuilder {
final MagicPlayerDefinition player2=new MagicPlayerDefinition("Computer",true,profile,14);
tournament.setPlayers(new MagicPlayerDefinition[]{player1,player2});
tournament.setStartPlayer(0);
tournament.setAIs(new MagicAI[]{null, new MCTSAI(true, true)});
tournament.setAIs(new MagicAI[]{null, MagicAIImpl.MCTS.getAI()});
final MagicGame game=tournament.nextGame(true);
game.setPhase(MagicMainPhase.getFirstInstance());

View File

@ -2,6 +2,7 @@ package magic.ui;
import java.util.HashMap;
import java.util.Map;
import java.util.Iterator;
public final class DelayedViewersThread extends Thread {
@ -33,11 +34,11 @@ public final class DelayedViewersThread extends Thread {
wait();
}
final long time = System.currentTimeMillis();
for (final DelayedViewer delayedViewer : delayedViewers.keySet()) {
final long delayedTime = delayedViewers.get(delayedViewer);
if (delayedTime <= time) {
delayedViewer.showDelayed();
delayedViewers.remove(delayedViewer);
for (Iterator<Map.Entry<DelayedViewer,Long>> iter = delayedViewers.entrySet().iterator(); iter.hasNext();) {
final Map.Entry<DelayedViewer, Long> entry = iter.next();
if (entry.getValue() <= time) {
entry.getKey().showDelayed();
iter.remove();
}
}

View File

@ -173,6 +173,9 @@ public class DownloadImagesDialog extends JDialog implements Runnable,ActionList
});
}
// clear images that are set to "missing image" in cache
magic.data.HighQualityCardImagesProvider.getInstance().clearCache();
IconImages.reloadSymbols();
if (!cancelDownload) {