Merge branch 'master' into 'master'

Fix networkplay issue on cardbackup view

See merge request core-developers/forge!4257
This commit is contained in:
Anthony Calosa
2021-03-25 02:54:59 +00:00
2 changed files with 7 additions and 4 deletions

View File

@@ -43,7 +43,6 @@ import forge.util.collect.FCollectionView;
public class CardView extends GameEntityView { public class CardView extends GameEntityView {
private static final long serialVersionUID = -3624090829028979255L; private static final long serialVersionUID = -3624090829028979255L;
private Card cardbackup;
public static CardView get(Card c) { public static CardView get(Card c) {
return c == null ? null : c.getView(); return c == null ? null : c.getView();
@@ -54,7 +53,10 @@ public class CardView extends GameEntityView {
return s == null ? null : s.getView(); return s == null ? null : s.getView();
} }
public CardView getBackup() { return cardbackup == null ? null : getCardForUi(cardbackup.getPaperCard()); } public CardView getBackup() {
return get(TrackableProperty.CardBackupView);
}
public static CardView getCardForUi(IPaperCard pc) { public static CardView getCardForUi(IPaperCard pc) {
return Card.getCardForUi(pc).getView(); return Card.getCardForUi(pc).getView();
} }
@@ -778,8 +780,8 @@ public class CardView extends GameEntityView {
updateZoneText(c); updateZoneText(c);
updateDamage(c); updateDamage(c);
if (cardbackup == null && !c.isFaceDown() && c.hasBackSide()) { if (getBackup() == null && !c.isFaceDown() && c.hasBackSide()) {
cardbackup = c.getCardForUi(); set(TrackableProperty.CardBackupView, c.getCardForUi().getView());
} }
boolean isSplitCard = c.isSplitCard(); boolean isSplitCard = c.isSplitCard();

View File

@@ -37,6 +37,7 @@ public enum TrackableProperty {
SplitCard(TrackableTypes.BooleanType), SplitCard(TrackableTypes.BooleanType),
MergedCards(TrackableTypes.StringType), MergedCards(TrackableTypes.StringType),
MergedCardsCollection(TrackableTypes.CardViewCollectionType, FreezeMode.IgnoresFreeze), MergedCardsCollection(TrackableTypes.CardViewCollectionType, FreezeMode.IgnoresFreeze),
CardBackupView(TrackableTypes.CardViewType),
Attacking(TrackableTypes.BooleanType), Attacking(TrackableTypes.BooleanType),
Blocking(TrackableTypes.BooleanType), Blocking(TrackableTypes.BooleanType),