mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
newGame: observers update before matchState was changed lead to new hanging thread creation
This commit is contained in:
@@ -29,6 +29,8 @@ import forge.control.input.InputMulligan;
|
|||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.zone.PlayerZone;
|
import forge.game.zone.PlayerZone;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
|
import forge.gui.framework.EDocID;
|
||||||
|
import forge.gui.framework.SDisplayUtil;
|
||||||
import forge.gui.match.CMatchUI;
|
import forge.gui.match.CMatchUI;
|
||||||
import forge.gui.match.VMatchUI;
|
import forge.gui.match.VMatchUI;
|
||||||
import forge.gui.match.controllers.CMessage;
|
import forge.gui.match.controllers.CMessage;
|
||||||
@@ -56,9 +58,15 @@ public class GameNew {
|
|||||||
*/
|
*/
|
||||||
public static void newGame(final PlayerStartsGame... players) {
|
public static void newGame(final PlayerStartsGame... players) {
|
||||||
Singletons.getControl().changeState(FControl.MATCH_SCREEN);
|
Singletons.getControl().changeState(FControl.MATCH_SCREEN);
|
||||||
|
SDisplayUtil.showTab(EDocID.REPORT_LOG.getDoc());
|
||||||
|
|
||||||
GameNew.newGameCleanup();
|
// Update observers
|
||||||
GameNew.newMatchCleanup();
|
AllZone.getStack().updateObservers();
|
||||||
|
AllZone.getInputControl().updateObservers();
|
||||||
|
AllZone.getGameLog().updateObservers();
|
||||||
|
|
||||||
|
newGameCleanup();
|
||||||
|
newMatchCleanup();
|
||||||
|
|
||||||
Card.resetUniqueNumber();
|
Card.resetUniqueNumber();
|
||||||
|
|
||||||
@@ -77,6 +85,7 @@ public class GameNew {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
bf.updateObservers();
|
bf.updateObservers();
|
||||||
|
p.getPlayer().getZone(ZoneType.Hand).updateObservers();
|
||||||
}
|
}
|
||||||
|
|
||||||
GameNew.actuateGame(players);
|
GameNew.actuateGame(players);
|
||||||
|
|||||||
@@ -65,8 +65,6 @@ public enum CMatchUI implements CardContainer {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void initMatch(final String strAvatarIcon) {
|
public void initMatch(final String strAvatarIcon) {
|
||||||
SDisplayUtil.showTab(EDocID.REPORT_LOG.getDoc());
|
|
||||||
|
|
||||||
// Update avatars
|
// Update avatars
|
||||||
final String[] indices = Singletons.getModel().getPreferences().getPref(FPref.UI_AVATARS).split(",");
|
final String[] indices = Singletons.getModel().getPreferences().getPref(FPref.UI_AVATARS).split(",");
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@@ -95,19 +93,6 @@ public enum CMatchUI implements CardContainer {
|
|||||||
view.getLblAvatar().setIcon(new ImageIcon(img));
|
view.getLblAvatar().setIcon(new ImageIcon(img));
|
||||||
view.getLblAvatar().getResizeTimer().start();
|
view.getLblAvatar().getResizeTimer().start();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update observers
|
|
||||||
AllZone.getHumanPlayer().updateObservers();
|
|
||||||
AllZone.getHumanPlayer().getZone(ZoneType.Hand).updateObservers();
|
|
||||||
AllZone.getHumanPlayer().getZone(ZoneType.Battlefield).updateObservers();
|
|
||||||
|
|
||||||
AllZone.getComputerPlayer().updateObservers();
|
|
||||||
AllZone.getComputerPlayer().getZone(ZoneType.Hand).updateObservers();
|
|
||||||
AllZone.getComputerPlayer().getZone(ZoneType.Battlefield).updateObservers();
|
|
||||||
|
|
||||||
AllZone.getStack().updateObservers();
|
|
||||||
AllZone.getInputControl().updateObservers();
|
|
||||||
AllZone.getGameLog().updateObservers();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ public enum FModel {
|
|||||||
// Set gameplay preferences and constants
|
// Set gameplay preferences and constants
|
||||||
final HttpUtil pinger = new HttpUtil();
|
final HttpUtil pinger = new HttpUtil();
|
||||||
final String url = ForgeProps.getProperty(NewConstants.CARDFORGE_URL) + "/draftAI/ping.php";
|
final String url = ForgeProps.getProperty(NewConstants.CARDFORGE_URL) + "/draftAI/ping.php";
|
||||||
Constant.Runtime.NET_CONN = (pinger.getURL(url).equals("pong") ? true : false);
|
Constant.Runtime.NET_CONN = false; // (pinger.getURL(url).equals("pong") ? true : false);
|
||||||
|
|
||||||
this.setBuildInfo(new BuildInfo());
|
this.setBuildInfo(new BuildInfo());
|
||||||
FModel.loadDynamicGamedata();
|
FModel.loadDynamicGamedata();
|
||||||
|
|||||||
Reference in New Issue
Block a user