From 4f94248d8b39c70d799c98c30b6ed301478d4109 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Fri, 7 Dec 2007 21:33:31 +0000 Subject: [PATCH] Wait to start a party and seated continuous EZ games until we've heard playerReady() from at least one player. git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@522 c613c5cb-e716-0410-b11b-feb51c14d237 --- .../ezgame/server/EZGameManager.java | 35 +++++++++++++------ 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/src/java/com/threerings/ezgame/server/EZGameManager.java b/src/java/com/threerings/ezgame/server/EZGameManager.java index ca527fe3..8b333334 100644 --- a/src/java/com/threerings/ezgame/server/EZGameManager.java +++ b/src/java/com/threerings/ezgame/server/EZGameManager.java @@ -564,16 +564,6 @@ public class EZGameManager extends GameManager _ezObj = (EZGameObject) _plobj; _ezObj.setEzGameService( (EZGameMarshaller) CrowdServer.invmgr.registerDispatcher(new EZGameDispatcher(this))); - - // if we don't need the no-show timer, start right away (but allow the manager startup - // process to finish before doing so) - if (!needsNoShowTimer()) { - CrowdServer.omgr.postRunnable(new Runnable() { - public void run () { - startGame(); - } - }); - } } @Override // from PlaceManager @@ -619,6 +609,27 @@ public class EZGameManager extends GameManager } } + @Override // from PlaceManager + protected void playersAllHere () + { + switch (getMatchType()) { + default: + case GameConfig.SEATED_GAME: + super.playersAllHere(); + break; + + case GameConfig.PARTY: + case GameConfig.SEATED_CONTINUOUS: + // the first time the first player calls playerReady() in a party or seated continuous + // game, we start the game; after that it's up to the game to restart itself + if (!_haveAutoStarted && _gameobj.state == EZGameObject.PRE_GAME) { + _haveAutoStarted = true; + startGame(); + } + break; + } + } + @Override protected void didShutdown () { @@ -779,6 +790,10 @@ public class EZGameManager extends GameManager /** Handles the storage of our user cookies; lazily initialized. */ protected GameCookieManager _cookMgr; + /** Tracks whether or not we've auto-started a non-seated game. Unfortunately there's no way to + * derive this from existing game state. */ + protected boolean _haveAutoStarted; + /** The minimum delay a ticker can have. */ protected static final int MIN_TICKER_DELAY = 50;