mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
Avoid copying unneccessary information to card views that can't be shown anyway
This commit is contained in:
@@ -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()));
|
||||
|
||||
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user