Fixed cleint exception problem with transformable cards.

This commit is contained in:
LevelX2 2016-07-02 18:38:29 +02:00
parent 7cfdd80c57
commit 1c2aa4c10a
2 changed files with 64 additions and 58 deletions

View file

@ -1,13 +1,13 @@
package org.mage.card.arcane;
import mage.cards.MagePermanent;
import javax.swing.*;
import java.awt.*;
import java.util.Timer;
import java.util.TimerTask;
import javax.swing.*;
import mage.cards.MagePermanent;
public abstract class Animation {
private static boolean ENABLED = true;
private static final long TARGET_MILLIS_PER_FRAME = 30;
@ -74,9 +74,11 @@ public abstract class Animation {
}
/**
* Uses averaging of the time between the past few frames to provide smooth animation.
* Uses averaging of the time between the past few frames to provide smooth
* animation.
*/
private static class FrameTimer {
private static final int SAMPLES = 6;
private static final long MAX_FRAME = 100; // Max time for one frame, to weed out spikes.
@ -189,7 +191,7 @@ public abstract class Animation {
parent.toggleTransformed();
}
state = true;
panel.transformAngle = 0;
panel.transformAngle = 1;
parent.onEndAnimation();
parent.repaint();
@ -326,7 +328,6 @@ public abstract class Animation {
Animation.enlargedAnimationPanel = null;
}
animationPanel.setAnimationPanel(true);
final JLayeredPane layeredPane = SwingUtilities.getRootPane(overPanel).getLayeredPane();
layeredPane.setLayer(animationPanel, JLayeredPane.MODAL_LAYER);

View file

@ -29,6 +29,7 @@ package mage.view;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.ConcurrentModificationException;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@ -116,12 +117,16 @@ public class PlayerView implements Serializable {
}
}
}
try {
for (Permanent permanent : state.getBattlefield().getAllPermanents()) {
if (showInBattlefield(permanent, state)) {
PermanentView view = new PermanentView(permanent, game.getCard(permanent.getId()), createdForPlayerId, game);
battlefield.put(view.getId(), view);
}
}
} catch (ConcurrentModificationException e) {
// can happen as a player left battlefield while PlayerView is created
}
this.topCard = player.isTopCardRevealed() && player.getLibrary().size() > 0
? new CardView(player.getLibrary().getFromTop(game)) : null;
if (player.getUserData() != null) {