mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08: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) {
|
private void writeCardToView(final Card c, final CardView view, final LocalGameView gameView) {
|
||||||
// First, write the values independent of other views.
|
// First, write the values independent of other views.
|
||||||
ViewUtil.writeNonDependentCardViewProperties(c, view, gameView.mayShowCard(c), gameView.mayShowCardFace(c));
|
boolean mayShowCard = gameView.mayShowCard(c);
|
||||||
// Next, write the values that depend on other views.
|
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();
|
final Combat combat = game.getCombat();
|
||||||
view.setOwner(getPlayerView(c.getOwner()));
|
view.setOwner(getPlayerView(c.getOwner()));
|
||||||
view.setController(getPlayerView(c.getController()));
|
view.setController(getPlayerView(c.getController()));
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ public final class ViewUtil {
|
|||||||
view.setMayBeShown(mayShowCard);
|
view.setMayBeShown(mayShowCard);
|
||||||
view.setZone(c.getZone() == null ? null : c.getZone().getZoneType());
|
view.setZone(c.getZone() == null ? null : c.getZone().getZoneType());
|
||||||
view.setHasAltState(hasAltState);
|
view.setHasAltState(hasAltState);
|
||||||
|
if (!mayShowCard) { return; } //remaining properties aren't needed if card can't be shown
|
||||||
|
|
||||||
view.setFaceDown(c.isFaceDown());
|
view.setFaceDown(c.isFaceDown());
|
||||||
view.setCloned(c.isCloned());
|
view.setCloned(c.isCloned());
|
||||||
view.setFlipCard(c.isFlipCard());
|
view.setFlipCard(c.isFlipCard());
|
||||||
|
|||||||
Reference in New Issue
Block a user