Avoid copying unneccessary information to card views that can't be shown anyway

This commit is contained in:
drdev
2014-10-02 20:08:20 +00:00
parent 3ea9e25c66
commit d7bcbdd04b
2 changed files with 8 additions and 2 deletions

View File

@@ -452,8 +452,12 @@ public abstract class LocalGameView implements IGameView {
private void writeCardToView(final Card c, final CardView view, final LocalGameView gameView) {
// First, write the values independent of other views.
ViewUtil.writeNonDependentCardViewProperties(c, view, gameView.mayShowCard(c), gameView.mayShowCardFace(c));
// Next, write the values that depend on other views.
boolean mayShowCard = gameView.mayShowCard(c);
ViewUtil.writeNonDependentCardViewProperties(c, view, mayShowCard, gameView.mayShowCardFace(c));
// Next, write the values that depend on other views if card can be shown
if (!mayShowCard) { return; }
final Combat combat = game.getCombat();
view.setOwner(getPlayerView(c.getOwner()));
view.setController(getPlayerView(c.getController()));

View File

@@ -38,6 +38,8 @@ public final class ViewUtil {
view.setMayBeShown(mayShowCard);
view.setZone(c.getZone() == null ? null : c.getZone().getZoneType());
view.setHasAltState(hasAltState);
if (!mayShowCard) { return; } //remaining properties aren't needed if card can't be shown
view.setFaceDown(c.isFaceDown());
view.setCloned(c.isCloned());
view.setFlipCard(c.isFlipCard());