forked from External/mage
GUI: fixed empty battlefield/players after reconnection, if it still empties then press any skip button (closes #11201)
This commit is contained in:
parent
9322c13926
commit
491c9cbe04
1 changed files with 10 additions and 2 deletions
|
|
@ -632,7 +632,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void init(int messageId, GameView game) {
|
public synchronized void init(int messageId, GameView game, boolean callGameUpdateAfterInit) {
|
||||||
addPlayers(game);
|
addPlayers(game);
|
||||||
// default menu states
|
// default menu states
|
||||||
setMenuStates(
|
setMenuStates(
|
||||||
|
|
@ -642,8 +642,10 @@ public final class GamePanel extends javax.swing.JPanel {
|
||||||
holdingPriority
|
holdingPriority
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (callGameUpdateAfterInit) {
|
||||||
updateGame(messageId, game);
|
updateGame(messageId, game);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void addPlayers(GameView game) {
|
private void addPlayers(GameView game) {
|
||||||
this.players.clear();
|
this.players.clear();
|
||||||
|
|
@ -773,6 +775,12 @@ public final class GamePanel extends javax.swing.JPanel {
|
||||||
|
|
||||||
public synchronized void updateGame(int messageId, GameView game, boolean showPlayable, Map<String, Serializable> options, Set<UUID> targets) {
|
public synchronized void updateGame(int messageId, GameView game, boolean showPlayable, Map<String, Serializable> options, Set<UUID> targets) {
|
||||||
keepLastGameData(messageId, game, showPlayable, options, targets);
|
keepLastGameData(messageId, game, showPlayable, options, targets);
|
||||||
|
|
||||||
|
if (this.players.isEmpty() && !game.getPlayers().isEmpty()) {
|
||||||
|
logger.warn("Found empty players list, trying to init game again (possible reason: reconnection)");
|
||||||
|
init(messageId, game, false);
|
||||||
|
}
|
||||||
|
|
||||||
prepareSelectableView();
|
prepareSelectableView();
|
||||||
updateGame();
|
updateGame();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue