newGame: observers update before matchState was changed lead to new hanging thread creation

This commit is contained in:
Maxmtg
2012-10-06 19:21:59 +00:00
parent fb1f1d383c
commit bf50b09610
3 changed files with 12 additions and 18 deletions

View File

@@ -29,6 +29,8 @@ import forge.control.input.InputMulligan;
import forge.game.player.Player;
import forge.game.zone.PlayerZone;
import forge.game.zone.ZoneType;
import forge.gui.framework.EDocID;
import forge.gui.framework.SDisplayUtil;
import forge.gui.match.CMatchUI;
import forge.gui.match.VMatchUI;
import forge.gui.match.controllers.CMessage;
@@ -56,9 +58,15 @@ public class GameNew {
*/
public static void newGame(final PlayerStartsGame... players) {
Singletons.getControl().changeState(FControl.MATCH_SCREEN);
SDisplayUtil.showTab(EDocID.REPORT_LOG.getDoc());
GameNew.newGameCleanup();
GameNew.newMatchCleanup();
// Update observers
AllZone.getStack().updateObservers();
AllZone.getInputControl().updateObservers();
AllZone.getGameLog().updateObservers();
newGameCleanup();
newMatchCleanup();
Card.resetUniqueNumber();
@@ -77,6 +85,7 @@ public class GameNew {
}
}
bf.updateObservers();
p.getPlayer().getZone(ZoneType.Hand).updateObservers();
}
GameNew.actuateGame(players);

View File

@@ -65,8 +65,6 @@ public enum CMatchUI implements CardContainer {
*
*/
public void initMatch(final String strAvatarIcon) {
SDisplayUtil.showTab(EDocID.REPORT_LOG.getDoc());
// Update avatars
final String[] indices = Singletons.getModel().getPreferences().getPref(FPref.UI_AVATARS).split(",");
int i = 0;
@@ -95,19 +93,6 @@ public enum CMatchUI implements CardContainer {
view.getLblAvatar().setIcon(new ImageIcon(img));
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();
}
/**

View File

@@ -148,7 +148,7 @@ public enum FModel {
// Set gameplay preferences and constants
final HttpUtil pinger = new HttpUtil();
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());
FModel.loadDynamicGamedata();