diff --git a/src/as/com/threerings/parlor/client/TableDirector.as b/src/as/com/threerings/parlor/client/TableDirector.as index b82dde3c..ab68aaee 100644 --- a/src/as/com/threerings/parlor/client/TableDirector.as +++ b/src/as/com/threerings/parlor/client/TableDirector.as @@ -96,11 +96,12 @@ public class TableDirector extends BasicDirector */ public function willEnterPlace (place :PlaceObject) :void { + // the place should be a TableLobbyObject + _tlobj = TableLobbyObject(place); + _lobby = place; + // add ourselves as a listener to the place object place.addListener(this); - - // and remember this for later - _lobby = place; } /** @@ -114,6 +115,7 @@ public class TableDirector extends BasicDirector // clear out our lobby reference _lobby = null; + _tlobj = null; } /** @@ -298,8 +300,22 @@ public class TableDirector extends BasicDirector // documentation inherited from interface public function tableCreated (tableId :int) :void { - // nothing much to do here - log.info("Table creation succeeded [tableId=" + tableId + "]."); + if (_lobby == null) { + // we've left, it's none of our concern anymore + log.info("Table created, but no lobby. [tableId=" + tableId + "]."); + return; + } + + // All this to check to see if we created a party game (and should now enter). + var table :Table = (_tlobj.getTables().get(tableId) as Table); + if (table == null) { + log.warning("Table created, but where is it? [tableId=" + tableId + "]"); + return; + } + if (table.gameOid != 0 && table.isPartyGame()) { + // let's boogie! + _pctx.getParlorDirector().gameIsReady(table.gameOid); + } } // documentation inherited from interface @@ -358,6 +374,9 @@ public class TableDirector extends BasicDirector /** The place object in which we're currently managing tables. */ protected var _lobby :PlaceObject; + /** The place object, cast as a TableLobbyObject. */ + protected var _tlobj :TableLobbyObject; + /** The field name of the distributed set that contains our tables. */ protected var _tableField :String; diff --git a/src/java/com/threerings/parlor/client/TableDirector.java b/src/java/com/threerings/parlor/client/TableDirector.java index 10c8098f..f69a092b 100644 --- a/src/java/com/threerings/parlor/client/TableDirector.java +++ b/src/java/com/threerings/parlor/client/TableDirector.java @@ -94,11 +94,12 @@ public class TableDirector extends BasicDirector */ public void willEnterPlace (PlaceObject place) { + // the place should be a TableLobbyObject + _tlobj = (TableLobbyObject) place; + _lobby = place; + // add ourselves as a listener to the place object place.addListener(this); - - // and remember this for later - _lobby = place; } /** @@ -112,6 +113,7 @@ public class TableDirector extends BasicDirector // clear out our lobby reference _lobby = null; + _tlobj = null; } /** @@ -294,8 +296,22 @@ public class TableDirector extends BasicDirector // documentation inherited from interface public void tableCreated (int tableId) { - // nothing much to do here - Log.info("Table creation succeeded [tableId=" + tableId + "]."); + if (_lobby == null) { + // we've left, it's none of our concern anymore + Log.info("Table created, but no lobby. [tableId=" + tableId + "]."); + return; + } + + // All this to check to see if we created a party game (and should now enter). + Table table = (Table) _tlobj.getTables().get(tableId); + if (table == null) { + Log.warning("Table created, but where is it? [tableId=" + tableId + "]"); + return; + } + if (table.gameOid != 0 && table.isPartyGame()) { + // let's boogie! + _ctx.getParlorDirector().gameIsReady(table.gameOid); + } } // documentation inherited from interface @@ -357,6 +373,9 @@ public class TableDirector extends BasicDirector /** The place object in which we're currently managing tables. */ protected PlaceObject _lobby; + /** The place object, cast as a TableLobbyObject. */ + protected TableLobbyObject _tlobj; + /** The field name of the distributed set that contains our tables. */ protected String _tableField; diff --git a/src/java/com/threerings/parlor/server/TableManager.java b/src/java/com/threerings/parlor/server/TableManager.java index d366ba7f..484a02f9 100644 --- a/src/java/com/threerings/parlor/server/TableManager.java +++ b/src/java/com/threerings/parlor/server/TableManager.java @@ -154,11 +154,6 @@ public class TableManager // if the table has only one seat, start the game immediately if (table.shouldBeStarted()) { int oid = createGame(table); - - // the creator will not be moved automatically, so we do it for them - if (isParty) { - CrowdServer.plreg.locprov.moveBody(creator, oid); - } } // finally let the caller know what the new table id is