merged
commit
a0858d44e8
|
@ -23,4 +23,5 @@ public interface CardImagesProvider {
|
|||
final int index,
|
||||
final boolean high);
|
||||
|
||||
void clearCache();
|
||||
}
|
||||
|
|
|
@ -71,4 +71,9 @@ public class HighQualityCardImagesProvider implements CardImagesProvider {
|
|||
public static CardImagesProvider getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public void clearCache() {
|
||||
origImages.clear();
|
||||
scaledImages.clear();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue